Skip to main content

Posts

Showing posts from May, 2012

Displaying different views in google map

Displaying different views in google map In order to load Google map in your application, 1. Obtain Google map API key ( how to obtain google api key  ) 2. Add permission on your manifest file to access internet 3. Add uses library in your manifest file for accessing Google Map 4. Extends MapActivity in your class (instead of Activity) main.xml <? xml   version = "1.0"   encoding = "utf-8" ?> < LinearLayout   xmlns:android = "http://schemas.android.com/apk/res/android"      android:orientation = "vertical"      android:layout_width = "fill_parent"      android:layout_height = "fill_parent"      > < com.google.android.maps.MapView          android:id = "@+id/mapView"          android:layout_width = "fill_parent"          android:layout_height = "fill_parent"          android:enabled = "true"          android:clickable = "true"          android:apiKey = "0G

Obtaining Google Map API key for Android/Using Google Map in Android/ Setting UP of release API Key for Google Map in Android

Obtaining API key for Google Map View in Android/MD5 fingerprint key/Google map in android Google map application is bundled with Android platform. We can customize Google map in many ways  such as changing views, adding markers and more.  In order to use Google map in your android app, you need to apply for a free Google Maps API key. To apply for a key,locate SDK debug certificate located in the default folder ( "C:\Documents and Settings\<username>\Local Settings\Application Data\Android\debug.keystore" . )For easiness, copy debug.keystore file to a folder in C( for example, create a folder called " C:\Android " ). Using this key, you can extract MD5 finger print using the keytool.exe application included with your jdk installation. You can locate keytool.exe from “ C:\Program Files\Java\<JDK_version_number>\bin ”  To get the Google Map API KEY Create a folder named “android” in your c drive and copy debug.keystore file( "C:\Document

Example for Activity Life Cycle/Introdution to Activities in Android

Activity Life Cycle/Activity life cycle example in android An activity represents a single screen with a user interface A users can interact in order to do something, such as dial the phone, take a photo, send an email, or view a map An activity is implemented as a subclass of Activity An application usually consists of multiple activities that are loosely bound to each other Example for Activity LifeCycle LifeCycleActivity .java   public class LifeCycleActivity extends Activity {      /** Called when the activity is first created. */     @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Toast.makeText(this, "onCreate()", Toast.L E N  G TH_LO N   G ).show(); } @Override protected void onStart() { //the activity is become visible. super.onStart(); Toast.makeText(this, "onStart()", Toast.L E N  G TH_LO N   G ).show(); } @Override protected void on P ause() { super.onPause();

Custom Spinner in Android

Custom Spinner in Android/Spinner using custom adapter/spinner with icon and text  In this tutorial, i'll show you to customizing spinner in different methods.  To change the normal display of spinner view, add background image using the code " android:background="@drawable/myspinner_background" in the xml. You can also make it customizable by setting up an xml file in drawable folder Custom display with icon in the spinner   main.xml <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"     android:orientation = "vertical"     android:layout_width = "fill_parent"     android:layout_height = "fill_parent"     >     < Spinner     android:drawSelectorOnTop = "true"     android:id = "@+id/spinner1"     android:layout_width = "match_parent"     android:layout_height = "wrap_content&