Skip to main content

Posts

Showing posts from April, 2014

Display Google Map using API V2 in android

Displaying Google Map in android using the API version 1 is deprecated now. Google introduce a lot of changes in displaying Google Map using API version 2. In this post i demonstrate how to display the Google Map using API Version 2. Ads By Google Step 1: Install the Google Play Service SDK  For displaying Map using API V2, you need the Google Play Services. So first step is to open your Android SDK manager and install the Google Play Services. Step 2: Add the Google Play Service as a library project into your android work-space.  After the successful installation of Google Play Service SDK, you can find out the Google play service library project on the following location in your android SDK folder.                                             sdk-->Extras-->Google Import the Google Play Services as a library project into the work-space. Don't forget to choose the options for copy the project into workspace.  Step 3: Add the Google play library

android fragment example

In this post i am going to present a simple example about fragments in android. In this example there are  two fragments presents, and add them into the main activity using two separate relative layouts. There are two buttons on the main activity, first button is for open the first fragment and by clicking the second button user can open the second fragment. Ads By Google MainActivity.java 1: public class MainActivity extends Activity { 2: Button B1,B2; 3: @Override 4: protected void onCreate(Bundle savedInstanceState) { 5: super.onCreate(savedInstanceState); 6: setContentView(R.layout.activity_main); 7: B1 = (Button)findViewById(R.id.b1); 8: B2 = (Button)findViewById(R.id.b2); 9: B1.setOnClickListener(new OnClickListener() { 10: @Override 11: public void onClick(View arg0) { 12: FragmentManager FM = getFragmentManager(); 13: Fra