Friday, November 28, 2014

Free guide, The Secrets to App Success on Google Play, by Google

A downloadable guide to help developers find success with your app or game business on Google Play. In it, you’ll find features, tips, and best practices to help you build an effective strategy.


The guide is separated into the following sections:
  • Publishing on Google Play — using the Google Play Developer Console to distribute your app to over 1 billion Android users worldwide.
  • Quality — The fundamentals of building a great app and an insight into the Google Play guidelines and policies.
  • Discoverability & reach — Maximizing your app's discoverability and reaching the widest audience possible.
  • Engagement & retention — Converting installations into active users and improving user retention.
  • Monetization — Monetization strategies to generate ongoing, growing revenue streams.
  • Measurement with Google Analytics — Understanding your users and improving your app experience, conversions, and marketing.
  • Going global — Launching your app in local markets around the world.
Download the guide in PDF format, or get it on Google Play.


Thursday, November 27, 2014

Keynote of Connect event: Visual Studio in a world of multiple devices

Get a deeper look on the next version of Visual Studio, and the innovation delivered to help you modernize existing applications faster and create new ones targeting multiple devices.

Wednesday, November 26, 2014

FREE Android Quick Start Guide, Android 5.0, Lollipop, by Google

Google provide FREE book Android Quick Start Guide, Android 5.0, Lollipop on Google Play Books. Introduces Android 5.0™ (Lollipop) for Nexus and Google Play edition devices. Available globally. For complete online help, see http://support.google.com/android.


Android Fragments

Android Fragments is a 100-page quick start accelerated guide to learning and quickly using Android fragments. You'll learn how to code for fragments; deal with config changes; code for regular vs. fragmented dialogs; work with preferences and saving state; work with the compatibility library; and handle advanced async tasks and progress dialogs.

After reading and using this book, which is based on material from the best-selling Pro Android, you'll be an Android UI savant. At the very least, your apps' user interfaces and event handling will be more competitive and better performing, especially for tablet-optimized UIs and events.

What you’ll learn
  • What are Android fragments
  • How to work and code for fragments
  • How to respond to configuration changes
  • How to do regular and fragmented dialogs
  • How to work with preferences and saving state
  • How to work with the compatibility library
  • How to handle advanced async tasks and progress dialogs
Who this book is for
This book is for experienced Android app developers wanting improved user interfaces and their behavior.

Table of Contents
1. Fragments Fundamentals
2. Responding to Configuration Changes
3. Dialogs: Regular and Fragment
4. Working with Preferences and Saving State
5. Compatibility Library
6. Advanced Async Task & Progress Dialogs

Saturday, November 22, 2014

Get phone number from Contacts database, using Intent.ACTION_PICK

This example show how to get phone number from Contacts database, using Intent.ACTION_PICK.


MainActivity.java
package com.example.androidreadcontact;

import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class MainActivity extends ActionBarActivity {

 Button buttonReadContact;
 TextView textPhone;

 final int RQS_PICKCONTACT = 1;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  buttonReadContact = (Button) findViewById(R.id.readcontact);
  textPhone = (TextView) findViewById(R.id.phone);

  buttonReadContact.setOnClickListener(new OnClickListener() {

   @Override
   public void onClick(View v) {
    // Start activity to get contact
    final Uri uriContact = ContactsContract.Contacts.CONTENT_URI;
    Intent intentPickContact = new Intent(Intent.ACTION_PICK,
      uriContact);
    startActivityForResult(intentPickContact, RQS_PICKCONTACT);
   }
  });
 }

 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
  if (resultCode == RESULT_OK) {
   if (requestCode == RQS_PICKCONTACT) {
    Uri returnUri = data.getData();
    Cursor cursor = getContentResolver().query(returnUri, null,
      null, null, null);

    if (cursor.moveToNext()) {
     int columnIndex_ID = cursor
       .getColumnIndex(ContactsContract.Contacts._ID);
     String contactID = cursor.getString(columnIndex_ID);

     int columnIndex_HASPHONENUMBER = cursor
       .getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER);
     String stringHasPhoneNumber = cursor
       .getString(columnIndex_HASPHONENUMBER);

     if (stringHasPhoneNumber.equalsIgnoreCase("1")) {
      Cursor cursorNum = getContentResolver()
        .query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
          null,
          ContactsContract.CommonDataKinds.Phone.CONTACT_ID
            + "=" + contactID, null, null);

      // Get the first phone number
      if (cursorNum.moveToNext()) {
       int columnIndex_number = cursorNum
         .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
       String stringNumber = cursorNum
         .getString(columnIndex_number);
       textPhone.setText(stringNumber);
      }

     } else {
      textPhone.setText("NO Phone Number");
     }

    } else {
     Toast.makeText(getApplicationContext(), "NO data!",
       Toast.LENGTH_LONG).show();
    }
   }
  }
 }

}

/res/layout/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.androidreadcontact.MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:autoLink="web"
        android:text="http://android-er.blogspot.com/"
        android:textStyle="bold" />

    <Button
        android:id="@+id/readcontact"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Read Contact" />

    <TextView
        android:id="@+id/phone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

Add permission of "android.permission.READ_CONTACTS" in AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.androidreadcontact"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />
    <uses-permission android:name="android.permission.READ_CONTACTS"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

download filesDownload the files.


Friday, November 21, 2014

Voice search in your app

You can integrate voice search in your Android app by adding just a few lines. For example, users can now say to the Google app: “Ok Google, search Hawaiian pizza on Eat24”, “Ok Google, search for hotels in Maui on TripAdvisor” or “Ok Google, search for Hawaiian Music on TuneIn” thanks to Google Now Actions. Google Now Actions allow you to take advantage of Google’s speech recognition technology to understand natural language, and turn it into Android intents delivered to your app.

Try the code sample: https://github.com/google/search-samples/tree/master/search-action and learn more at http://developer.android.com/guide/components/intents-common.html#Search

If you’d like to explore recent advances in speach recognition technology, also check out “Behind the Mic: The Science of Talking with Computers”: https://www.youtube.com/watch?v=yxxRAHVtafI


Thursday, November 20, 2014

Android 5.0 Lollipop Overview for Nexus Devices

In this episode of XDA TV Producer rirozizo shows you what Lollipop looks like using his Nexus 4. He shows of the user interfact changes. He shows you the new notification panel. He talks about ambient display. If you wanted to see Lollipop in action, check out this video.

Thursday, November 13, 2014

Android 5.0 Lollipop rollout has started and will soon be available on most #Nexus devices

Google's Android team announced on Twitter at 12 Nov, AndroidLollipop rollout has started and will soon be available on most Nexus devices. Nexus 4, Nexus 5, Nexus 7 (both models), and Nexus 10 will all start to receive Lollipop over-the-air (OTA) shortly.


If you can't wait for the OTA, you can download it from the page of Factory Images for Nexus DevicesThis page contains binary image files that allow you to restore your Nexus device's original factory firmware. You will find these files useful if you have used the Android Open-Source Project, flashed custom builds on your device, and wish to return that device to its factory state.


Tuesday, November 11, 2014

Building JavaScript Games: for Phones, Tablets, and Desktop

Building JavaScript Games: for Phones, Tablets, and Desktop

Building JavaScript Games teaches game programming through a series of engaging, arcade-style games that quickly expand your JavaScript and HTML5 skills. JavaScript is in the top ten most-used programming languages world wide, and is the basis for applications that can run in any modern browser, on any device from smart phone to tablet to PC. Especial emphasis is given to touch-based interface, but all games also run using a regular mouse and keyboard setup.

The four games you’ll develop from reading this book are:
  • Painter
  • Jewel Jam
  • Penguin Pairs
  • Tick Tick
These four games are casual, arcade-style games representing the aim-and-shoot, puzzle, maze, and platform styles of game play.

The approach in Building JavaScript Games follows the basic structure of a game rather than the syntax of a language. From almost the very first chapter you are building games to run on your phone or other device and show to your friends. Successive projects teach about handling player input, manipulating game objects, designing game worlds, managing levels, and realism through physics. All told, you’ll develop four well-designed games, making Building JavaScript Games one of the most enjoyable ways there is to learn about programming browser-based games.

The final chapters in the book contain a very nice bonus of sorts. In them you will find excerpts from interviews with two prominent people from the game industry: Mark Overmars, who is CTO of Tingly Games and creator of GameMaker, and Peter Vesterbacka, the CMO of Rovio Entertainment - the creators of the Angry Birds franchise. Their insight and perspective round off what is already a fun and valuable book.

What you’ll learn
  • Create games to run on phones and tablets
  • Manage sprites and other game objects
  • React to player input through touch and button presses
  • Allow game players to progress through different levels
  • Achieve realistic movement through applied physics
  • Prepare your games properly for commercial deployment
Who this book is for
Building JavaScript Games is for technology enthusiasts interested in learning about programming, and especially about game programming on their mobile devices. The book is also ideal for programmers in other languages wanting to make the move to mobile development using the cross-platform environment of JavaScript and HTML5. If you’re interested in browser-based development, especially the development of mobile games, then Building JavaScript Games is the perfect choice.

Table of Contents

Part I
1 - Programming
2 - Game Programming Basics
3 - Creating a Game World
4 - Game Assets

Part II
5 - Knowing What the Player is Doing
6 - Reacting to Player Input
7 - Basic Game Objects
8 - Game Object Types
9 - Colors and Collisions
10 - Limited Lives
11 - Organizing Game Objects
12 - Finishing the Game

Part III
13 - Adapting to Different Devices
14 - Game Objects in a Structure
15 - Gameplay Programming
16 - Game States
17 - Finishing the Game

Part IV
18 - Sprite Sheets
19 - Menus and Settings
20 - Game State Management
21 - Storing and Recalling Game Data
22 - Pairing the Penguins
23 - Finishing the Game

Part V
24 - The Main Game Structure
25 - Animation
26 - Game Physics
27 - Intelligent Enemies
28 - Adding Player Interaction
29 - Finishing the Game

Part VI
30 - Efficient and Readable Code
31 - Deploying your Game

Learn C++ for Game Development

If you’re new to C++ but understand some basic programming, then Learn C++ for Game Development lays the foundation for the C++ language and API that you’ll need to build game apps and applications.

Learn C++ for Game Development will show you how to:
  • Master C++ features such as variables, pointers, flow controls, functions, I/O, classes, exceptions, templates, and the Standard Template Library (STL)
  • Use design patterns to simplify your coding and make more powerful games
  • Manage memory efficiently to get the most out of your creativity
  • Load and save games using file I/O, so that your users are never disappointed
Most of today's popular console and PC game platforms use C++ in their SDKs. Even the Android NDK and now the iOS SDK allow for C++; so C++ is growing in use for today's mobile game apps. Game apps using C++ become much more robust, better looking, more dynamic, and better performing. After reading this book, you’ll have the skills to become a successful and profitable game app or applications developer in today’s increasingly competitive indie game marketplace.

The next stage is to take the foundation from this book and explore SDKs such as Android/Ouya, PlayStation, Wii, Nintendo DS, DirectX, Unity3D, and GameMaker Studio to make your career really take off.

Putin presents Russian-designed dual-screen YotaPhone 2 to Chinese president

Russia's President Vladimir Putin has presented a Russian-produced smartphone YotaPhone-2 to Chinese President Xi Jinping at their meeting in Beijing.



Tuesday, November 4, 2014

Get your app in the Google index

Get your app in the Google index — and be ready for the future of search! Try the hands-on codelab at: http://bit.ly/index-my-app.

Google set out to index to mobile apps, to bringing accessibility and discoverability to them. App Indexing is the ability for Google to index apps just like websites. Deep links to your Android app appear in Google Search results so users can get to your native mobile experience quickly, landing exactly on the right content within the app.
  • Drive return visits to your app
    For users who have your app installed, having deep links appear in search results will help drive organic traffic back to your app.
  • Re-engage your users
    For users who have viewed pages in your app, and later searches for similar content, you can use the App Indexing API to have deep links appear in search suggestions. For example, a user visits a pizza restaurant page in an app. The next time the user searches for pizza, a deep link will appear in search suggestions before seeing search results.
Create a seamless experience for your users App indexing is flexible—you can direct search users to your app or website on a page by page basis. Moving from search results to apps is seamless, without any pop-ups or extra taps to slow users down.


To learn more, check out: https://developers.google.com/app-indexing


Saturday, November 1, 2014

Search and display Map Tile using Here REST API

This example search loaction, and display coresponding Map Tile on Android using Here REST API.




MainActivity.java
package com.example.androidheregeocoder;

import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;

import android.support.v7.app.ActionBarActivity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends ActionBarActivity {

 public class GeocodingTask extends AsyncTask<String, Void, String> {

  TextView textViewRqs, textViewParsed;
  String rqs;
  
  HereResponse geoCodingRes;

  GeocodingTask(TextView vRqs, TextView vParsed) {
   textViewRqs = vRqs;
   textViewParsed = vParsed;
  }

  @Override
  protected String doInBackground(String... params) {

   final String rqs = "http://geocoder.cit.api.here.com/6.2/geocode.xml"
     + "?searchtext=" + params[0] + "&gen=7"
     + "&app_id=DemoAppId01082013GAL"
     + "&app_code=AJKnXv84fjrb0KIHawS0Tg";

   runOnUiThread(new Runnable(){

    @Override
    public void run() {
     textViewRqs.setText(rqs);
    }});
   
   geoCodingRes = Parse(rqs);
   return geoCodingRes.toString();
  }

  @Override
  protected void onPostExecute(String result) {
   textViewParsed.setText(result);
   
   if(!geoCodingRes.DisplayPosition_Latitude.equals("")
    &&!geoCodingRes.DisplayPosition_Longitude.equals("")){
    double lat = Double.parseDouble(geoCodingRes.DisplayPosition_Latitude);
    double lon = Double.parseDouble(geoCodingRes.DisplayPosition_Longitude);
    updateHereMap(lat, lon);
   }
  }

  private HereResponse Parse(String urlString) {
   HereResponse hereResponse = new HereResponse();

   final String XmlTag_Response = "Response";
   final String XmlTag_MetaInfo = "MetaInfo";
   final String XmlTag_Timestamp = "Timestamp";
   final String XmlTag_View = "View";
   final String XmlTag_ViewId = "ViewId";
   final String XmlTag_Result = "Result";
   final String XmlTag_Location = "Location";
   
   final String XmlTag_DisplayPosition = "DisplayPosition";
   final String XmlTag_NavigationPosition = "NavigationPosition";
   final String XmlTag_TopLeft = "TopLeft";
   final String XmlTag_BottomRight = "BottomRight";
   
   final String XmlTag_Latitude = "Latitude";
   final String XmlTag_Longitude = "Longitude";
   
   final String XmlTag_Label = "Label";
   final String XmlTag_Country = "Country";
   final String XmlTag_State = "State";
   final String XmlTag_County = "County";
   final String XmlTag_City = "City";
   final String XmlTag_District = "District";
   final String XmlTag_Street = "Street";
   final String XmlTag_HouseNumber = "HouseNumber";
   final String XmlTag_PostalCode = "PostalCode";
   
   String xmlPara = "";
   String xmlGroupPara = "";

   XmlPullParserFactory factory;
   try {
    factory = XmlPullParserFactory.newInstance();
    factory.setNamespaceAware(false);
    XmlPullParser xpp = factory.newPullParser();
    xpp.setInput((new URL(urlString)).openConnection()
      .getInputStream(), "UTF_8");

    int eventType;
    do {
     xpp.next();
     eventType = xpp.getEventType();

     switch (eventType) {
     case XmlPullParser.START_DOCUMENT:
      xmlPara = "";  //0;
      xmlGroupPara = ""; //0;
      break;

     case XmlPullParser.END_DOCUMENT:
      break;

     case XmlPullParser.START_TAG:
      String tag = xpp.getName();
      
      xmlPara = tag;

      if(tag.equals(XmlTag_DisplayPosition)
       || tag.equals(XmlTag_NavigationPosition)
       || tag.equals(XmlTag_TopLeft)
       || tag.equals(XmlTag_BottomRight)){
       xmlGroupPara = tag;
      }

      break;

     case XmlPullParser.END_TAG:
      break;

     case XmlPullParser.TEXT:
      
      if(xmlPara.equals(XmlTag_Timestamp)){
       hereResponse.Timestamp = xpp.getText();
      }else if(xmlPara.equals(XmlTag_ViewId)){
       hereResponse.ViewId = xpp.getText();
      }else if(xmlPara.equals(XmlTag_Latitude)){
       if(xmlGroupPara.equals(XmlTag_DisplayPosition)){
        hereResponse.DisplayPosition_Latitude = xpp.getText();
       }else if(xmlGroupPara.equals(XmlTag_NavigationPosition)){
        hereResponse.NavigationPosition_Latitude = xpp.getText();
       }else if(xmlGroupPara.equals(XmlTag_TopLeft)){
        hereResponse.TopLeft_Latitude = xpp.getText();
       }else if(xmlGroupPara.equals(XmlTag_BottomRight)){
        hereResponse.BottomRight_Latitude = xpp.getText();
       }
      }else if(xmlPara.equals(XmlTag_Longitude)){
       if(xmlGroupPara.equals(XmlTag_DisplayPosition)){
        hereResponse.DisplayPosition_Longitude = xpp.getText();
       }else if(xmlGroupPara.equals(XmlTag_NavigationPosition)){
        hereResponse.NavigationPosition_Longitude = xpp.getText();
       }else if(xmlGroupPara.equals(XmlTag_TopLeft)){
        hereResponse.TopLeft_Longitude = xpp.getText();
       }else if(xmlGroupPara.equals(XmlTag_BottomRight)){
        hereResponse.BottomRight_Longitude = xpp.getText();
       }
      }else if(xmlPara.equals(XmlTag_Label)){
       hereResponse.Label = xpp.getText();
      }else if(xmlPara.equals(XmlTag_Country)){
       hereResponse.Country = xpp.getText();
      }else if(xmlPara.equals(XmlTag_State)){
       hereResponse.State = xpp.getText();
      }else if(xmlPara.equals(XmlTag_County)){
       hereResponse.County = xpp.getText();
      }else if(xmlPara.equals(XmlTag_City)){
       hereResponse.City = xpp.getText();
      }else if(xmlPara.equals(XmlTag_District)){
       hereResponse.District = xpp.getText();
      }else if(xmlPara.equals(XmlTag_Street)){
       hereResponse.Street = xpp.getText();
      }else if(xmlPara.equals(XmlTag_HouseNumber)){
       hereResponse.HouseNumber = xpp.getText();
      }else if(xmlPara.equals(XmlTag_PostalCode)){
       hereResponse.PostalCode = xpp.getText();
      }
      
      break;
     }

    } while (eventType != XmlPullParser.END_DOCUMENT);
   } catch (XmlPullParserException e) {
    hereResponse.err = (e.getMessage());
    e.printStackTrace();
   } catch (MalformedURLException e) {
    hereResponse.err = (e.getMessage());
    e.printStackTrace();
   } catch (IOException e) {
    hereResponse.err = (e.getMessage());
    e.printStackTrace();
   }

   return hereResponse;
  }

 }
 
 public class HereResponse {

  String Timestamp = "";
  String ViewId = "";
  String DisplayPosition_Latitude = "";
  String DisplayPosition_Longitude = "";
  String NavigationPosition_Latitude = "";
  String NavigationPosition_Longitude = "";
  String TopLeft_Latitude = "";
  String TopLeft_Longitude = "";
  String BottomRight_Latitude = "";
  String BottomRight_Longitude = "";
  
  String Label = "";
  String Country = "";
  String State = "";
  String County = "";
  String City = "";
  String District = "";
  String Street = "";
  String HouseNumber = "";
  String PostalCode = "";
  
  String err = "";

  public String toString() {
   return "Timestamp: " + Timestamp + "\n"
    + "ViewId: " + ViewId + "\n"
    + "DisplayPosition_Latitude: " + DisplayPosition_Latitude + "\n"
    + "DisplayPosition_Longitude: " + DisplayPosition_Longitude + "\n"
    + "NavigationPosition_Latitude: " + NavigationPosition_Latitude + "\n"
    + "NavigationPosition_Longitude: " + NavigationPosition_Longitude + "\n"
    + "TopLeft_Latitude: " + TopLeft_Latitude + "\n"
    + "TopLeft_Longitude: " + TopLeft_Longitude + "\n"
    + "BottomRight_Latitude: " + BottomRight_Latitude + "\n"
    + "BottomRight_Longitude: " + BottomRight_Longitude + "\n"
    
    + "Label: " + Label + "\n"
    + "Country: " + Country + "\n"
    + "State: " + State + "\n"
    + "County: " + County + "\n"
    + "City: " + City + "\n"
    + "District: " + District + "\n"
    + "Street: " + Street + "\n"
    + "HouseNumber: " + HouseNumber + "\n"
    + "PostalCode: " + PostalCode + "\n"
    
    + "err: " + err;
  }
 }
 
 public class LoadHereMapTask extends AsyncTask<URL, Void, Bitmap> {
  
  ImageView imageView;
  
  LoadHereMapTask(ImageView v){
   imageView = v;
  }

  @Override
  protected Bitmap doInBackground(URL... params) {
   Bitmap bm = null;
   URL urlMapImage = params[0];
   try {
    bm = BitmapFactory.decodeStream(urlMapImage.openConnection().getInputStream());
   } catch (IOException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
   return bm;
  }

  @Override
  protected void onPostExecute(Bitmap result) {
   imageView.setImageBitmap(result);
  }

 }
 
 private void updateHereMap(double lat, double lon){
  URL urlTarget;
  
  textMapRqs.setText("");
  mapImage.setImageBitmap(null);
  
  try {
   String strTarget = genHereMapTileRequest(lat, lon);
   textMapRqs.setText(strTarget);
   urlTarget = new URL(strTarget);
   new LoadHereMapTask(mapImage).execute(urlTarget);

  } catch (MalformedURLException e) {
   e.printStackTrace();
  }
 }
 
 private String getMercatorProjection(double lat, double lon, int z){
  /*
   * reference:
   * http://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/key-concepts.html
   */
  
  double latRad = lat * Math.PI/180;
  double n = Math.pow(2, z);
  double xTile = n * ((lon + 180)/360);
  double yTile = n * (1-(Math.log(Math.tan(latRad) + 1/Math.cos(latRad))/Math.PI))/2;
  
  String strProjection = "/"+ String.valueOf(z)
   + "/" + String.valueOf((int)xTile)
   + "/" + String.valueOf((int)yTile);
  
  return strProjection;
 }
 
 private String genHereMapTileRequest(double lat, double lon){
  /*
   * reference:
   * https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/resource-map-tile.html
   */
  
  String BaseURL = "http://1.base.maps.cit.api.here.com";
  String Path = "/maptile/2.1/";
  String Resource = "maptile";
  String Version = "/newest";
  String scheme = "/normal.day";
  String pixelCnt = "/512";

  String ApplicationId = "DemoAppId01082013GAL";  //for demo
  String ApplicationCode = "AJKnXv84fjrb0KIHawS0Tg"; //for demo
  String png8 = "/png8";

  //Always zoom = 12
  String strZoomColumnRow = getMercatorProjection(lat, lon, 12);

  String rqs = BaseURL + Path + Resource + Version + scheme + strZoomColumnRow
    + pixelCnt
    + png8
    + "?app_id=" + ApplicationId
    + "&app_code=" + ApplicationCode;

  return rqs;
 }

 EditText textAddressIn;
 Button buttonGet;
 TextView textRqs, textParsed;
 
 TextView textMapRqs;
 ImageView mapImage;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  textAddressIn = (EditText) findViewById(R.id.addressin);
  buttonGet = (Button) findViewById(R.id.get);
  textRqs = (TextView) findViewById(R.id.textrqs);
  textParsed = (TextView) findViewById(R.id.textparsed);
  
  textMapRqs = (TextView) findViewById(R.id.maprqs);
  mapImage = (ImageView) findViewById(R.id.mapimage);

  // for easy testing
  textAddressIn.setText("425 W Randolph Street in Chicago");

  buttonGet.setOnClickListener(new OnClickListener() {

   @Override
   public void onClick(View v) {
    String strIn = textAddressIn.getText().toString();
    if (!strIn.equals("")) {
     String strHtml = strIn.replace(" ", "+");
     
     getGetGeocode(strHtml);
    }
   }
  });
 }

 private void getGetGeocode(String addr) {
  new GeocodingTask(textRqs, textParsed).execute(addr);
 }

}

/res/layout/activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.androidheregeocoder.MainActivity" >

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:autoLink="web"
            android:text="http://android-er.blogspot.com/"
            android:textStyle="bold" />

        <EditText
            android:id="@+id/addressin"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <Button
            android:id="@+id/get"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Get Geocode" />

        <TextView
            android:id="@+id/textrqs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent" >

            <TextView
                android:id="@+id/textparsed"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />
        </ScrollView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/maprqs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <ImageView
            android:id="@+id/mapimage"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
    </LinearLayout>

</LinearLayout>

uses-permission of "android.permission.INTERNET" is needed in AndroidManifest.xml.

download filesDownload the files.

~ More examples of using Here Map REST API on Android