Skip to main content

Posts

Showing posts from March, 2013

Android Intents PART-2

1. Launching the Music Player Intent myActivity2 = new Intent("android.intent.action.MUSIC_PLAYER"); startActivity(myActivity2); 2. Playing a song stored in the SD card Intent myActivity2 = new Intent(android.content.Intent.ACTION_VIEW); Uri data = Uri.parse("file:///sdcard/test.mp3"); String type = "audio/mp3"; myActivity2.setDataAndType(data, type); startActivity(myActivity2); 3. Sending MMS Uri uri = Uri.parse("content://media/external/images/media/1"); Intent i = new Intent(Intent.ACTION_SEND); i.putExtra("address", "555-1234"); i.putExtra("sms_body", "some text message"); i.putExtra(Intent.EXTRA_STREAM, uri); i.setType("image/png"); startActivity(i); 4. Sending Email Uri uri = Uri.parse("mailto:dhaval0122@gmail.com"); Intent myActivity2 = new Intent(Intent.ACTION_SENDTO, uri); myActivity2.putExtra(Intent.EXTRA_SUBJECT, &q

Android Intents PART-1

1. Display the phone dialer with the given number Intent myActivity2 = new Intent (Intent.ACTION_DIAL, Uri.parse( "tel:987-654-3210")); 2. Doing a Google search Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, "DJ-android blog"); startActivity(intent); 3. Show all your Contacts String myData = "content://contacts/people/"; Intent myActivity2 = new Intent(Intent.ACTION_VIEW,Uri.parse(myData)); startActivity(myActivity2); 4. Show a Particular Contact String myData = "content://contacts/people/100"; Intent myActivity2 = new Intent(Intent.ACTION_VIEW,Uri.parse(myData)); startActivity(myActivity2); 5. Edit a Particular Contact String myData = "content://contacts/people/2"; Intent myActivity2 = new Intent(Intent.ACTION_EDIT,Uri.parse(myData)); startActivity(myActivity2); 6. Geo Mapping an Address String geoCode = "geo:0,0?q=