Saturday, February 23, 2013

Android Maps API v2 API Key Generate

Android  Maps API v2 API Key Generate

Google introduced new Maps Android API v2.
Below  how to generate an API key in Maps Android API v2

What in API V2?
*Android API v2 they are using Vector tile so maps loading too fast even slower connection.
*Maps are encapsulated with map fragment class and its extension of android Fragment class
* Maps Now in 3D.
*Caching also improved so user can see without empty areas.

Google Developer Documentation

*NOTE: Android Maps API v2 not supporting in Emulator only supporting real device.

Getting Started Maps Android API v2

Step 1.
Before getting Google map key
First you have to generate Fingerprint SHA1 digital signatures.
Let see how to do...

Get your keystore file and GOTO cmd prompt

C:\Program Files\Java\jre7\bin>keytool.exe -list -v -alias androiddebugkey -keys
tore "D:\debug.keystore" -storepass android -keypass android

Then you will fingerprint SHA1 Value .Check the below screen shot.

Step 2

Go to this Below Link
Google API Console 

There you can able to see like below image. Select API Access

 Step 3

Go to the bottom of  the Page
There you can able to see like below screen shot  and select create a new android key

Step 4.

If you select the create new android key. Then one popup will appear like below the screenshot.

Step 5.
Successfully Google API key generated

Check the below screen shot

Step 6:
Configure you MAP API Key to your project


fragment xmlns:android=""


Manifest file

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    android:versionName="1.0" >

  <uses-permission android:name="com.whatsaround.whatsaround.permission.MAPS_RECEIVE"/>
        android:targetSdkVersion="16" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name=""/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>


        android:theme="@style/AppTheme" >
    android:value="HERE YOUR API KEY"/>
            android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />


*Note Map V2 not supported in emulator so please check in real device

Sunday, February 17, 2013

Android Activity method from the adapter class

Android Activity method from the adapter class

Below the example for how to call activity method from adapter class.

Some time I try to call activity method from base adapter or adapter class but I unable to call this method or I am getting some error. So finally I got the solution .
Below the code
Create Interface Class 

public interface RefreshInterface {
public void refresh();

Then implement this interface to your activity class.

    public void onCreate(Bundle savedInstanceState) {

MyArrayAdapter myAdapter = new MyArrayAdapter(getApplicationContext(), R.layout.appsview_item, List, new RefreshInterface () {
                  public void refresh() {
          //do something here
Call activity method from adapter class

public class MyArrayAdapterextends ArrayAdapter<Structure> {

RefreshInterface intr;
public MyArrayAdapter(Context context, int textViewResourceId,
                  List<App> objects, RefreshInterface refreshInt) {
            super(context, textViewResourceId, objects);
            intr = refreshInt;

public View getView(final int position, View appView, ViewGroup parent) {

//this is your activity method



Check out this may be help you

Related Posts Plugin for WordPress, Blogger...