Google has announced an update to its map activity, Google Maps, for manoeuvrable devices. The update v6.1 focusses on listing for exoteric transit options in most 500 cities crosswise the orbit.

 

Google in a blog stake detailed the improvements that the update brings to the procedure force. Now Google Maps users can hold suggested routes and effort present for solon than 1 million public pass stops crossways the group. Google instrument also give inside directions for work.

 

“We’ve prefabricated any changes to the Installation Lines bed, so that you can superior a peculiar style of people charge (prepare, bus, ropeway or railroad) to showing on the motile map, hiding the remaining modes. This is helpful in areas where there is a binding density of individual types of people journey,” said the blog.

 

Mitt: Metropolis map with all modes of exclusive journey shown; Right: Journeying Lines sheet in Tube property

 

Left: Mobile map with all modes of public transit shown; Right: Transit Lines layer in Subway mode

Left: Mobile map with all modes of public transit shown; Right: Transit Lines layer in Subway mode

Moreover, Google has updated the layout of rank pages to be many recyclable. Open it by tapping on the name of the position on your metropolis map.

Updated station pages show you departure times, lines serving the station and the distance to nearby stations.

Updated station pages show you departure times, lines serving the station and the distance to nearby stations.

Updated send pages lead you feat present, lines serving the displace and the length to nearby devotion.

 

Apart from the new journey features, Google has also updated realm lightness, My Places and Activity History displays in Maps. Users faculty now be fit to see borders of a part. New tabs feature been supplemental low My Places that enables users to make all their collection from a bingle judge, also mechanism offline. The Locating Chronicle give now estimate users to nosh the destinations they jazz been on a regular component, with an updated Emplacement Account dashboard.

 

Google’s last edition of Google Maps is currently exclusive gettable for Golem platform. The lot will be propulsion out the update for remaining platforms real presently. Automaton users can download the update from the Google Endeavour keep.

 

The update to Google Maps become at a second when Apple is geartrain up for its own procedure pair. According to reports, Apple testament is releasing its self-branded procedure services in the next version of the iPhone, which is rumoured to get incoming month. Late, Apple declared dropping built-in YouTube app from its IOS 6.

Reference – http://googleblog.blogspot.in/2012/08/google-maps-now-has-schedules-for-more.html#!/2012/08/google-maps-now-has-schedules-for-more.html

Avoid Dependencies In a library: Android

When providing a library like a parser for location-based information one of the most important points is to not create any kind of dependency into the application which later uses the library.
But what does this mean? Here is a small example:
The application ApplA wants to get the location for a certain GPS position and store it into an ApplA.LocationObject, so a request to the library would look like this:

 

 1: ApplA.LocationObject o= locationLib.getLocationFor(longitude,latitude);

 

And here is the problem why this is not the right way to do it: If someone else wants to use the library in another application B, this application would need the ApplA.LocationObject which it will not have access to. So the developer of application B would need to change the library code to return a ApplB.LocationObject and this would have to be done every time the library is imported into a new application. Often it not even possible to change the library code because it’s wrapped in a non editable jar-file so another solution has to be found.
The most obvious solution would be to move the LocationObject class into the library and return a Library.LocationObj for the request. Then a developer would need to use this LocationObj in his or her application or the information would have to be extracted from the Library.LocationObj and stored in a ApplA.LocationObj. This solution is not very flexible and will force the developer to be dependant on the objects it gets from the library or convert them at least. He has to determine what is stored in the Library.LocationObj and how to get access to this information.
Lets take a step back to what the developer would really want to get. It is information about the location at a certain GPS position so how do we return this information and not a static object where the developer has to figure out how to use it and get to the information inside. The answer to this question is the listener concept and here is how it works:
The user will pass an additional object (the listener) when requesting the location for the GPS position, so it will look like this:

 

 1: Library.LocationListener l = new ApplA.MyLocationObject();
 2: locationLib.getLocationFor(longitude,latitude, l);And the ApplA.MyLocationObject would have to look like this:
 3: class ApplA.MyLocationObject implements Library.LocationListener{
 4:  ...
 5:  public void onRecieveLocationInformation(String locName, String address, ...){
 6:   //store the received information
 7:  }
 8: }

 

The library then has to call the onRecieveLocationInformation-method when the information is parsed. This way the ApplA.MyLocationObject now only has to implement the LocationListener interface and it will be notified by the library when the location information is received. It will get all the information about the location and can store these in its custom way.
The listener concept is a very powerful way to remove dependencies and this is only one of many scenarios where it can be used. There are a lot more benefits when using this concept, for example this way the request to the server could be done in a separate thread much easier because the code is no longer structured in a linear way.
Here is one more example how your code could look like, when using the listener concept:

 

 1: final MyLocationObject o = new MyLocationObject();
 2: locationLib.getLocationFor(longitude,latitude, new Library.LocationListener(){
 3:  public void onRecieveLocationInformation(String locName, String address, ...){
 4:   //store the received information:
 5:   o.setName(locName);
 6:   o.setAddress(address);
 7:   addLocationToLocationList(o);
 8:  }
 9: });
 10: 
 11: ...
 12: 
 13: void addLocationToLocationList(o){
 14:  ...
 15: }

 

So what do you think about this? Feel free to add some comments Open-mouthed smile

Random Name Generator: Android

Today i needed a name generator so i wrote one myself (i didn’t like the existing ones i found via Google. Here is the test code i used:

   1:  NameGenerator gen = new NameGenerator();
   2:  for (int i = 0; i < 30; i++) { System.out.println(gen.getName()); } 

It produces names like:
Pausyp
Braurjnn
Thushoob
Einnjk
Qeidegh
Aub
Xoihut
Voopych
Gljint
Och
Stontaigh
Loofautt
Grennoogh
Jshjnt
Zjlouv
Fabeih
Aishof
Hoir
Ait
Jihoint
Aiv
Poim
Flott
Ustjv
Zjis
Xittoutt
I also added constructors for complete customization of the generate process. Here is the code:

   1:  public class NameGenerator {
   2:  private List vocals = new ArrayList();
   3:  private List startConsonants = new ArrayList();
   4:  private List endConsonants = new ArrayList();
   5:  private List nameInstructions = new ArrayList();
   6:  public NameGenerator() {
   7:  String demoVocals[] = { "a", "e", "i", "o", "u", "ei", "ai", "ou", "j",
   8:  "ji", "y", "oi", "au", "oo" };
   9:  String demoStartConsonants[] = { "b", "c", "d", "f", "g", "h", "k",
  10:  "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z",
  11:  "ch", "bl", "br", "fl", "gl", "gr", "kl", "pr", "st", "sh",
  12:  "th" };
  13:  String demoEndConsonants[] = { "b", "d", "f", "g", "h", "k", "l", "m",
  14:  "n", "p", "r", "s", "t", "v", "w", "z", "ch", "gh", "nn", "st",
  15:  "sh", "th", "tt", "ss", "pf", "nt" };
  16:  String nameInstructions[] = { "vd", "cvdvd", "cvd", "vdvd" };
  17:  this.vocals.addAll(Arrays.asList(demoVocals));
  18:  this.startConsonants.addAll(Arrays.asList(demoStartConsonants));
  19:  this.endConsonants.addAll(Arrays.asList(demoEndConsonants));
  20:  this.nameInstructions.addAll(Arrays.asList(nameInstructions));
  21:  }
  22:  /**
  23:  * 
  24:  * The names will look like this
  25:  * (v=vocal,c=startConsonsonant,d=endConsonants): vd, cvdvd, cvd, vdvd
  26:  * 
  27:  * @param vocals
  28:  * pass something like {"a","e","ou",..}
  29:  * @param startConsonants
  30:  * pass something like {"s","f","kl",..}
  31:  * @param endConsonants
  32:  * pass something like {"th","sh","f",..}
  33:  */
  34:  public NameGenerator(String[] vocals, String[] startConsonants,
  35:  String[] endConsonants) {
  36:  this.vocals.addAll(Arrays.asList(vocals));
  37:  this.startConsonants.addAll(Arrays.asList(startConsonants));
  38:  this.endConsonants.addAll(Arrays.asList(endConsonants));
  39:  }
  40:  /**
  41:  * see {@link NameGenerator#NameGenerator(String[], String[], String[])}
  42:  * 
  43:  * @param vocals
  44:  * @param startConsonants
  45:  * @param endConsonants
  46:  * @param nameInstructions
  47:  * Use only the following letters:
  48:  * (v=vocal,c=startConsonsonant,d=endConsonants)! Pass something
  49:  * like {"vd", "cvdvd", "cvd", "vdvd"}
  50:  */
  51:  public NameGenerator(String[] vocals, String[] startConsonants,
  52:  String[] endConsonants, String[] nameInstructions) {
  53:  this(vocals, startConsonants, endConsonants);
  54:  this.nameInstructions.addAll(Arrays.asList(nameInstructions));
  55:  }
  56:  public String getName() {
  57:  return firstCharUppercase(getNameByInstructions(getRandomElementFrom(nameInstructions)));
  58:  }
  59:  private int randomInt(int min, int max) {
  60:  return (int) (min + (Math.random() * (max + 1 - min)));
  61:  }
  62:  private String getNameByInstructions(String nameInstructions) {
  63:  String name = "";
  64:  int l = nameInstructions.length();
  65:  for (int i = 0; i < l; i++) { char x = nameInstructions.charAt(0); switch (x) { case 'v': name += getRandomElementFrom(vocals); break; case 'c': name += getRandomElementFrom(startConsonants); break; case 'd': name += getRandomElementFrom(endConsonants); break; } nameInstructions = nameInstructions.substring(1); } return name; } private String firstCharUppercase(String name) { return Character.toString(name.charAt(0)).toUpperCase() + name.substring(1); } private String getRandomElementFrom(List v) {
  66:  return v.get(randomInt(0, v.size() - 1));
  67:  }
  68:  }

 

Comment Please.Rolling on the floor laughing

10 Rules Every Android Programmer Should Know

I’ve now read a few interesting things that you should consider when programming Android in order to ensure as much performance as possible:

  1. As rarely as possible allocate memory
  2. Possible use etc but no integer int.
  3. Temporary return values ​​to avoid if possible! Strings that are used once and then return to the no longer needed brakes, the system unnecessarily. Rather the operation on the string to move the method itself.
  4. Multidimensional arrays can be simulated by one dimensional. Rumgetrickse for me a bit too much at the expense of readability ..
  5. Virtual methods instead of interface methods (eg, not using hashmap Map)
  6. Static methods are much faster than virtual
  7. no getter and setter
  8. Instead of access to member variables, they should only pass to a local.
  9. Do not use enums but constants for the elements of enums
  10. Avoid use of floating point numbers as floating-point arithmetic must be simulates cumbersome.

    One has therefore to ensure the performance of a piece of code readability, reduce and rewrite in a few years, the unreadable code again.

Create a new project in Eclipse named AnimatedSplashScreen

AnimatedSplashScreenDoid1

AnimatedSplashScreenDoid1Add the following code to the strings.xml present in values folderstrings.xml

Create a new xml file in the res/layout folder named splash.xml and add the following code to it.

splash.xml

splash.xml

Add the following code to AndroidManifest.xml

AndroidManifest.xml

AndroidManifest.xml

Now add the following code to AnimatedSplashScreenActivity.java

 

AnimatedSplashScreenActivity.java

AnimatedSplashScreenActivity.java

 

AnimatedSplashScreenActivity.java

AnimatedSplashScreenActivity.java

Add a new class in the src folder and named MainActivity and add the following code to it.

MainActivity.java

MainActivity.java

And finally add the following code to main.xml

main.xml

main.xmlNow run the application and you will see a screen like below:Animated Splash Screen