Skip to main content

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=1860+east+18th+street+cleveland+oh";  
 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoCode));  
 startActivity(intent);  



 String geoCode = "geo:23.0333,72.6167";  
 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoCode));  
 startActivity(intent);  


 String thePlace = "Cleveland State University";  
 Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("geo:0,0?q= (" + thePlace + ")"));  
 startActivity(intent);  



 String geoCode = "google.streetview:cbll=41.5020952,-81.6789717&cbp=1,270,,45,1&mz=1";  
 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(geoCode));  
 startActivity(intent);  



You need below Permission :
 <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />  
 <uses-permission android:name="android.permission.INTERNET" />  

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...