Skip to main content

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, "subject goes here");  
 myActivity2.putExtra(Intent.EXTRA_TEXT,"The email's body goes here");  
 startActivity(myActivity2);  

5. Setting System
 Intent intent = new Intent(android.provider.Settings.ACTION_SETTINGS);  
 startActivity(intent);  


6. Setting System Locale: Language & Keyboard

 Intent intent = new Intent(android.provider.Settings.ACTION_LOCALE_SETTINGS);  
 startActivity(intent);  

Comments

Popular posts from this blog

Multi-Selection ListView ANDROID with CheckBox PART-2

Check Below Code : mainActivity.java package com.example.listviewcheckbox; import java.util.ArrayList; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.CheckBox; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { private ListView listview; ArrayList<String> items = new ArrayList<String>(); private int count; private boolean[] thumbnailsselection; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(...

Multi-Selection ListView ANDROID with CheckBox

Shaadi.com Indian Matrimonials Download code Create New Android Project: in res/layout/main.xml create new layout for list row : in res/layout/list_row.xml in your Main Activity Class: Create Class name mItems: Create New Class name SelectViewHolder: Create New Class name SelectArrayAdapter: Download Source Code Click Here : Check PART2 for more detail. Shaadi.com Matrimonials

Android - Notifications - 3 (Applying a big view style to a notification)

Big picture style Bitmap icon1 = BitmapFactory.decodeResource(getResources(), R.drawable.dhaval1); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder( this).setAutoCancel(true) .setContentTitle("DJ-Android notification") .setSmallIcon(R.drawable.ic_launcher).setLargeIcon(icon1) .setContentText("Hello World!"); NotificationCompat.BigPictureStyle bigPicStyle = new NotificationCompat.BigPictureStyle(); bigPicStyle.bigPicture(icon1); bigPicStyle.setBigContentTitle("Dhaval Sodha Parmar"); mBuilder.setStyle(bigPicStyle); // Creates an explicit intent for an Activity in your app Intent resultIntent = new Intent(this, testActivity.class); // The stack builder object will contain an artificial ba...