Wednesday, July 24, 2013

Android Custom Grid View Example | Image and Text in GridView in Android | Gridview demo in Android

Hello Friends,
Today I am sharing very simple useful post "Custom Grid View in Android".
All the code are given below just copy paste and enjoy. You can download zip folder from github also...

EDIT:On Item Click Make Toast



MainActivity.java


package com.manish.customgridview;

import java.util.ArrayList;


import android.os.Bundle;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.GridView;
import android.widget.Toast;
/**
 * 
 * @author manish.s
 *
 */

public class MainActivity extends Activity {
 GridView gridView;
 ArrayList<Item> gridArray = new ArrayList<Item>();
  CustomGridViewAdapter customGridAdapter;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  //set grid view item
  Bitmap homeIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.home);
  Bitmap userIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.personal);
  
  gridArray.add(new Item(homeIcon,"Home"));
  gridArray.add(new Item(userIcon,"User"));
  gridArray.add(new Item(homeIcon,"House"));
  gridArray.add(new Item(userIcon,"Friend"));
  gridArray.add(new Item(homeIcon,"Home"));
  gridArray.add(new Item(userIcon,"Personal"));
  gridArray.add(new Item(homeIcon,"Home"));
  gridArray.add(new Item(userIcon,"User"));
  gridArray.add(new Item(homeIcon,"Building"));
  gridArray.add(new Item(userIcon,"User"));
  gridArray.add(new Item(homeIcon,"Home"));
  gridArray.add(new Item(userIcon,"xyz"));
  
  
  gridView = (GridView) findViewById(R.id.gridView1);
  customGridAdapter = new CustomGridViewAdapter(this, R.layout.row_grid, gridArray);
  gridView.setAdapter(customGridAdapter);
  
  gridView.setOnItemClickListener(new OnItemClickListener() {

   @Override
   public void onItemClick(AdapterView<?> arg0, View v, int position,
     long arg3) {
    Toast.makeText(getApplicationContext(),gridArray.get(position).getTitle(), Toast.LENGTH_SHORT).show();
    
   }
  });
 }

}

CustomGridViewAdapter.java


package com.manish.customgridview;

import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * 
 * @author manish.s
 *
 */
public class CustomGridViewAdapter extends ArrayAdapter<Item> {
 Context context;
 int layoutResourceId;
 ArrayList<Item> data = new ArrayList<Item>();

 public CustomGridViewAdapter(Context context, int layoutResourceId,
   ArrayList<Item> data) {
  super(context, layoutResourceId, data);
  this.layoutResourceId = layoutResourceId;
  this.context = context;
  this.data = data;
 }

 @Override
 public View getView(int position, View convertView, ViewGroup parent) {
  View row = convertView;
  RecordHolder holder = null;

  if (row == null) {
   LayoutInflater inflater = ((Activity) context).getLayoutInflater();
   row = inflater.inflate(layoutResourceId, parent, false);

   holder = new RecordHolder();
   holder.txtTitle = (TextView) row.findViewById(R.id.item_text);
   holder.imageItem = (ImageView) row.findViewById(R.id.item_image);
   row.setTag(holder);
  } else {
   holder = (RecordHolder) row.getTag();
  }

  Item item = data.get(position);
  holder.txtTitle.setText(item.getTitle());
  holder.imageItem.setImageBitmap(item.getImage());
  return row;

 }

 static class RecordHolder {
  TextView txtTitle;
  ImageView imageItem;

 }
}

activity_main.xml


<RelativeLayout 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: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=".MainActivity" >

     <GridView
        android:id="@+id/gridView1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:columnWidth="80dp"
        android:gravity="center"
        android:numColumns="auto_fit"
        android:stretchMode="columnWidth" >
    </GridView>

</RelativeLayout>

row_grid.xml


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:padding="5dp" >

    <ImageView
        android:id="@+id/item_image"
        android:layout_width="50dp"
        android:layout_height="50dp"
        android:layout_marginRight="10dp"
        android:src="@drawable/home" >
    </ImageView>

    <TextView
        android:id="@+id/item_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="5dp"
        android:textSize="15sp" >
    </TextView>

</LinearLayout>

AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.manish.customgridview"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.manish.customgridview.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 Zip Code


Thanks!

Wednesday, July 10, 2013

How to unlock the Android Phone programmatically? | Code for start another activity when phone screen is lock | Alarm Manager in Android | Play Alarm in Android on scheduled time

Hello Friends,

I am Going to share very important and useful code for start your application when phone is lock. This demo will unlock your phone lock and start another activity class form first screen.

For this I am using Alarm manager which will start your application after every 10 second.


Intent intent = new Intent(this, NextActivity.class);
  PendingIntent pendingIntent = PendingIntent.getActivity(this, 12345,
    intent, PendingIntent.FLAG_CANCEL_CURRENT);
  AlarmManager am = (AlarmManager) getSystemService(Activity.ALARM_SERVICE);
  /**
   * if you want start your application only one time un-comment below
   * line code and comment next line code
   */
  // am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
  am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),
    1000 * 15, pendingIntent); 
 
 
And this is the code which will unlock your phone lock-
 
KeyguardManager km = (KeyguardManager) context
     .getSystemService(Context.KEYGUARD_SERVICE);
   final KeyguardManager.KeyguardLock kl = km
     .newKeyguardLock("MyKeyguardLock");
   kl.disableKeyguard();

   PowerManager pm = (PowerManager) context
     .getSystemService(Context.POWER_SERVICE);
   WakeLock wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
     | PowerManager.ACQUIRE_CAUSES_WAKEUP
     | PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
   wakeLock.acquire(); 
 
 

Full code

 

(A)MainActivity.java


package com.manish.nevigationapp;

import android.app.Activity;
import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends Activity {
 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  TextView text = (TextView) findViewById(R.id.textView1);
  text.setText("First Page");

  // Create a new PendingIntent and add it to the AlarmManager
  Intent intent = new Intent(this, NextActivity.class);
  PendingIntent pendingIntent = PendingIntent.getActivity(this, 12345,
    intent, PendingIntent.FLAG_CANCEL_CURRENT);
  AlarmManager am = (AlarmManager) getSystemService(Activity.ALARM_SERVICE);
  /**
   * if you want start your application only one time un-comment below
   * line code and comment next line code
   */
  // am.set(AlarmManager.RTC_WAKEUP, cal.getTimeInMillis(), pendingIntent);
  am.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(),
    1000 * 15, pendingIntent);
 }

} 
 

(B)activity_main.xml


<RelativeLayout 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: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=".MainActivity" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="Large Text"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout> 
 

(C)NextActivity.java


package com.manish.nevigationapp;

import java.io.IOException;

import android.app.Activity;
import android.app.KeyguardManager;
import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;

public class NextActivity extends Activity {
 private MediaPlayer mPlayer;

 @Override
 public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  setContentView(R.layout.activity_next);

  Button stopAlarm = (Button) findViewById(R.id.stopAlarm);
  stopAlarm.setOnTouchListener(new OnTouchListener() {
   public boolean onTouch(View arg0, MotionEvent arg1) {
    mPlayer.stop();
    finish();
    return false;
   }
  });

  playSound(this, getAlarmUri());
 }

 private void playSound(Context context, Uri alert) {
  mPlayer = new MediaPlayer();
  try {
   // unlock screen
   KeyguardManager km = (KeyguardManager) context
     .getSystemService(Context.KEYGUARD_SERVICE);
   final KeyguardManager.KeyguardLock kl = km
     .newKeyguardLock("MyKeyguardLock");
   kl.disableKeyguard();

   PowerManager pm = (PowerManager) context
     .getSystemService(Context.POWER_SERVICE);
   WakeLock wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK
     | PowerManager.ACQUIRE_CAUSES_WAKEUP
     | PowerManager.ON_AFTER_RELEASE, "MyWakeLock");
   wakeLock.acquire();
   // start alarm
   mPlayer.setDataSource(context, alert);
   final AudioManager audioManager = (AudioManager) context
     .getSystemService(Context.AUDIO_SERVICE);
   if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != 0) {
    mPlayer.setAudioStreamType(AudioManager.STREAM_ALARM);
    mPlayer.prepare();
    mPlayer.start();
   }
  } catch (IOException e) {
   System.out.println("Unable to play!");
  }
 }

 // Get an alarm sound.

 private Uri getAlarmUri() {
  Uri alert = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM);
  if (alert == null) {
   alert = RingtoneManager
     .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
   if (alert == null) {
    alert = RingtoneManager
      .getDefaultUri(RingtoneManager.TYPE_RINGTONE);
   }
  }
  return alert;
 }
} 
 

(D)activity_next.xml


<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    android:gravity="center" >
 
    <Button
        android:id="@+id/stopAlarm"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="stop alarm" />
 
</RelativeLayout> 
 

(E)AndroidManifest.xml


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.manish.nevigationapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.manish.nevigationapp.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>
        <activity android:name="com.manish.nevigationapp.NextActivity" />
    </application>

</manifest> 
 
 
Thanks!
Please put your suggestion and comment!

Sunday, July 7, 2013

Android Draw PolyLine in Google Map Version-2 | Google Map version-2 Integration in Android Draw polyLine

Hello Friends!
Today I am going to share very simple, useful, popular post on Google map version-2, for
drawing poly-line on tap on Google map.

Important steps are given below-
1)Generate SHA1 certificate for your Google map from google developer account from below link-
https://code.google.com/apis/
2)Create new android project.
3)Copy paste below given activity and layout.
4)Add Internet permission in your manifest.
5)Put your map key in manifest.
7)Enable your Network connection or GPS.
8)Run your project and tap on map for draw circle and marker.
9)Long press for remove circle.
10)Put your comment for more help.

(A)Print Screen:


(B)MainActivity:


package com.manish.googlemap;

import java.util.ArrayList;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.manish.googlemap.R;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.CircleOptions;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.PolylineOptions;
/**
 * @author manish
 *
 */
public class MainActivity extends FragmentActivity implements
  OnMapClickListener, OnMapLongClickListener{

 private GoogleMap googleMap;
 private ArrayList<LatLng> arrayPoints = null;
  PolylineOptions polylineOptions;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  arrayPoints = new ArrayList<LatLng>();
  SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
  googleMap = fm.getMap();
        googleMap.setMyLocationEnabled(true);
  
  googleMap.setOnMapClickListener(this);
  googleMap.setOnMapLongClickListener(this);
 
 }

 @Override
 public void onMapClick(LatLng point) {
  //add marker
  MarkerOptions marker=new MarkerOptions();
  marker.position(point);
  googleMap.addMarker(marker);
  // settin polyline in the map
    polylineOptions = new PolylineOptions();
    polylineOptions.color(Color.RED);
    polylineOptions.width(5);
    arrayPoints.add(point);
    polylineOptions.addAll(arrayPoints);
    googleMap.addPolyline(polylineOptions);
  }

 @Override
 public void onMapLongClick(LatLng point) {
  googleMap.clear();
  arrayPoints.clear();
 }
 

}

(C)activity_main.xml:


<RelativeLayout 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" >

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        class="com.google.android.gms.maps.SupportMapFragment" />
     
</RelativeLayout>

(D)AndroidManifest.xml:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.manish.googlemap"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.manish.googlemap.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>
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="Put Your Map Key Here!" />    </application>

</manifest>


Thanks!
 Please put your comment and suggestion for more help!

Friday, July 5, 2013

Android Draw Polygon in Google Map Version-2 | Custom Marker in Google Map Version-2 | Google Map version-2 Integration in Android Draw polygon

Hello Friends!
Today I am going to share very simple, useful, popular post on Google map version-2, for
drawing polygon and custom marker on tap on Google map.
Important steps are given below-
1)Generate SHA1 certificate for your Google map from google developer account from below link-
https://code.google.com/apis/
2)Create new android project.
3)Copy paste below given activity and layout.
4)Add Internet permission in your manifest.
5)Put your map key in manifest.
7)Enable your Network connection or GPS.
8)Run your project and tap on map for draw circle and marker.
9)Long press for remove circle.
10)Put your comment for more help.

(A)Print Screen:


(B)MainActivity:


package com.manish.googlemap;

import java.util.ArrayList;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;

import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.OnMapClickListener;
import com.google.android.gms.maps.GoogleMap.OnMapLongClickListener;
import com.google.android.gms.maps.GoogleMap.OnMarkerClickListener;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
import com.google.android.gms.maps.model.Polygon;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.PolylineOptions;

/**
 * @author manish
 * 
 */
public class MainActivity extends FragmentActivity implements
  OnMapClickListener, OnMapLongClickListener, OnMarkerClickListener {

 private GoogleMap googleMap;
 private ArrayList<LatLng> arrayPoints = null;
 PolylineOptions polylineOptions;
 private boolean checkClick = false;

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  arrayPoints = new ArrayList<LatLng>();
  SupportMapFragment fm = (SupportMapFragment) getSupportFragmentManager()
    .findFragmentById(R.id.map);
  googleMap = fm.getMap();
  // display zoom map
  googleMap.setMyLocationEnabled(true);

  googleMap.setOnMapClickListener(this);
  googleMap.setOnMapLongClickListener(this);
  googleMap.setOnMarkerClickListener(this);

 }

 @Override
 public void onMapClick(LatLng point) {
  if (checkClick == false) {

   googleMap.addMarker(new MarkerOptions().position(point).icon(
     BitmapDescriptorFactory.fromResource(R.drawable.point)));
   arrayPoints.add(point);
  }
 }

 @Override
 public void onMapLongClick(LatLng point) {
  googleMap.clear();
  arrayPoints.clear();
  checkClick = false;
 }

 public void countPolygonPoints() {
  if (arrayPoints.size() >= 3) {
   checkClick = true;
   PolygonOptions polygonOptions = new PolygonOptions();
   polygonOptions.addAll(arrayPoints);
   polygonOptions.strokeColor(Color.BLUE);
   polygonOptions.strokeWidth(7);
   polygonOptions.fillColor(Color.CYAN);
   Polygon polygon = googleMap.addPolygon(polygonOptions);
  }
 }

 @Override
 public boolean onMarkerClick(Marker marker) {
  // TODO Auto-generated method stub
  System.out.println("Marker lat long=" + marker.getPosition());
  System.out.println("First postion check" + arrayPoints.get(0));
  System.out
    .println("**********All arrayPoints***********" + arrayPoints);
  if (arrayPoints.get(0).equals(marker.getPosition())) {
   System.out.println("********First Point choose************");
   countPolygonPoints();
  }
  return false;
 }
}

(C)activity_main.xml:


<RelativeLayout 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" >

    <fragment
        android:id="@+id/map"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        class="com.google.android.gms.maps.SupportMapFragment" />
     
</RelativeLayout>

(D)AndroidManifest.xml:


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.manish.googlemap"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.manish.googlemap.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>
        <meta-data
            android:name="com.google.android.maps.v2.API_KEY"
            android:value="Put Your Map Key Here!" />    </application>

</manifest>


Thanks!
 Please put your comment and suggestion for more help!