Android Application Development Training Tutorial
For more info visit http://www.zybotech.in
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Google Map.
Introduction to Google Android Application Development
A software stack for mobile devices that includes an OS, middleware and key applications. The Android SDK includes tools like debugger, libraries, sample code and tutorials. Based on Linux and provides integration with other Google services (maps search etc). Android SDK has a wide range of built in features, and provides immense flexibility and opportunity to develop mobile applications. Not only can the technological companies rake in money but also individual entrepreneurs from various fields can. Android developers can be classified into android game developers and android application developers. Developers can take full advantage of the tools provided with the SDK like debugging etc, to build rich applications while maintaining basic features like making call , end text messages that are innovative and can be deployed on the mobile phone. The platform continues to emerge and evolve as one of the best developer community working together to build innovative mobile applications. Our Android application development team is well equipped to understand your needs and provide fast, effective, innovative solutions to our customers and cater the demands of developing Android applications. For more information please contact http://www.anubavam.com
Android Google Map Application Example
Android Google Maps Application
To integrate with Google maps application you need to apply for a free Google Map API Key. To get the Google Map API Key you need to sign up for the Android Maps API. To sign up, you will need to provide the certificates fingerprint (MD5). If you have a certificate fingerprint (MD5) you can sign up here and get the API Key.
To get certificate fingerprint (MD5) follow the simple steps below:
You need to get the keystore file for getting the certificate fingerprint (MD5). Your keystore file can be found at the following path
"C:\Documents and Settings\<username>\Local Settings\Application Data\Android"
(Or)
"C:\Documents and Settings\<username>\.android"
Keystore file name is "debug.keystore" file. Copy the "debug.keystore" file to some other folder (ex: - "D:\Androidkeystore\") (its user friendly to use). Open command Prompt and go to the Java installed directory. ("C:\Program Files\Java\<JDK_version_number>\bin") Then type the below line (given in box) and press enter.
keytool.exe -list -alias androiddebugkey -keystore
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
D:\AndroidKeystore\debug.keystore -storepass android -keypass android
Now you will get a
certificate fingerprint (MD5). (see the below image).
Here the MD5 certificate fingerprint is
"64:88:A2:FC:AA:9F:B1:B0:CA:E4:D0:24:A8:1E:77:FB"
Click here to go for sign up page to get Google Map API Key. Enter the MD5 certificate fingerprint in the textbox and get the API Key (see below image)
After clicking the Generate API Key Button , you will get Google Map API Key (red circled).
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Now the sample xml layout code to use the Google map application in Android is as specified below Coding:To use Google map in your application, you need to add <uses-library> element together with the <usespermission> in AndroidManifest.xml file. Now your AndroidManifest.xml code looks like
01 <?xml version="1.0? encoding="utf-8??> 02 <manifest xmlns:android="http://schemas.android.com/apk/res/android" 03 package="pack.sample.map" 04 android:versionCode="1? 05 android:versionName="1.0?> 06 <application android:icon="@drawable/icon" android:label="@string/app_name"> 07 <uses-library android:name="com.google.android.maps" /> 08 <activity android:name=".SampleMapApplication" 09 android:label="@string/app_name"> 10 <intent-filter> 11 <action android:name="android.intent.action.MAIN" /> 12 <category android:name="android.intent.category.LAUNCHER" /> 13 </intent-filter> 14 </activity> 15 </application> 16 <uses-permission android:name="android.permission.INTERNET"/> 17 </manifest>
To display map in your application, modify the main.xml file. It is located in <project-folder>/res/layout.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Use <com.google.android.maps.MapView> element to display map. Now your main.xml code looks like
01 <?xml version="1.0" encoding="utf-8"?> 02 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 03 android:layout_width="fill_parent" 04 android:layout_height="fill_parent"> 05 <com.google.android.maps.MapView 06 android:id="@+id/mapView" 07 android:layout_width="fill_parent" 08 android:layout_height="fill_parent" 09 android:enabled="true" 10 android:clickable="true" 11 android:apiKey="0U7-rnRk3Os0sPZnZF9iejONnHMsGRLxU0JbrBg"/> 12 </RelativeLayout>
Now edit your Java class file as specified below
01 @Override 02 public void onCreate(Bundle savedInstanceState) 03 { 04 super.onCreate(savedInstanceState); 05 setContentView(R.layout.main); 06 } 07 @Override 08 protected boolean isRouteDisplayed() { 09 return false; 10 }
Now run the application, you should be able to see the Google Map
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Status Bar.
Android Hide Status Bar
In previous posts we have already saw about how to Hide the title bar . Now we are going to see about how to hide the status bar. First of all see the below image to know which is Status bar & Title bar.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Hiding the title bar & status bar is used in gaming applications to show full screen to user. Hide the Status bar through code
01 @Override 02 public void onCreate(Bundle savedInstanceState) { 03 04 05 06 07 08 09 10 11 12 } setContentView(R.layout.tabs1); // Hide the Status Bar getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); // Hide the Title Bar requestWindowFeature(Window.FEATURE_NO_TITLE);
Hide the Title bar through AndroidManifest.xml
1 <activity android:name=".YourClassName" 2 android:theme="@android:style/Theme.NoTitleBar"/>
Hide the Status bar through AndroidManifest.xml
1 <activity android:name=".YourClassName" 2 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
Android Hide the title bar in 2 ways
In android, we can hide the title bar in 2 ways. Hiding the title bar is used to show the full screen in game applications, browser related applications, etc First method is through code , we have already seen that. Second method is through AndroidManifest.xml. You can give the below source in your androidmanifest.xml to hide the title bar.
1 <activity android:name=".YourClassName" 2 android:theme="@android:style/Theme.NoTitleBar"> 3 </activity>
The output will looks like Before,
After,
Hide the title bar in Android
When we develop a game or some other application, we may need to show a full page (screen) for users. In the below image, the Alarm Clock is the title showing in the title bar.
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
To remove this title bar we need to use,
1 @Override 2 public void onCreate(Bundle savedInstanceState) { 3 super.onCreate(savedInstanceState); 4 requestWindowFeature(Window.FEATURE_NO_TITLE); 5}
After this, the title bar will be removed as shown below
Set icon for title bar in Android
In Android we have the facility to set an icon for the title bar. In the below image the title bar contains only the title. Title name is Iconic Memory
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi
To set an icon in the title bar use the below piece of code
1 @Override 2 public void onCreate(Bundle savedInstanceState) { 3 super.onCreate(savedInstanceState); 4 requestWindowFeature(Window.FEATURE_RIGHT_ICON); 5 setContentView(R.layout.main); 6 setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON, R.drawable.icon); 7}
By using this code we can get the output as shown in the below image
A7, Stephanos Tower, Eachamukku, Kakkanadu,Kochi