Opening Contacts, Gallery and other system applications through Intent in Android

Code snippets for opening contacts, gallery etc through intent

// opening Contact
Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI);
startActivityForResult(intent, REQUEST_CODE);

// opening Gallery
Intent i = new Intent(Intent.ACTION_PICK);
startActivityForResult(i, 1);

// opening All
Intent i = new Intent(Intent.ACTION_PICK);
startActivityForResult(i, 1);

By setting the type of the intent object to image/*, gallery will display, accordingly if we put corresponding action and data , we can display SMS, settings page etc.

If we put the data of intent as "*/*", a pop-up will display, which shows the available list of the applications that can display.

The screen shot is,


Popular posts from this blog

Open Gallery and get the selected image in appplication

Dismiss or Cancel dialog by swipe gesture

AlarmManager and Notification in Android