Map Intent
package app.test;
import java.io.File;
import java.util.ArrayList;
import android.app.Activity;
import android.app.SearchManager;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.Contacts;
import android.view.Menu;
public class Test extends Activity {
private Intent browserIntent, phoneIntent, mapIntent, mailIntent, contactIntent, marketIntent, smsIntent;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mailIntent = new Intent();
mailIntent.setAction(Intent.ACTION_SEND);
mailIntent.setType("message/rfc822");
mailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"a@gmail.com"});
mailIntent.putExtra(Intent.EXTRA_CC, new String[] {"b@gmail.com"});
mailIntent.putExtra(Intent.EXTRA_BCC, new String[] {"c@gmail.com"});
mailIntent.putExtra(Intent.EXTRA_SUBJECT, "Email Subject");
mailIntent.putExtra(Intent.EXTRA_TEXT, "Body Text");
mailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new File(Environment.getExternalStorageDirectory(),"fileOne.txt")));
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add("Browser").setIntent(browserIntent);
menu.add("Phone").setIntent(phoneIntent);
menu.add("Map").setIntent(mapIntent);
menu.add("Mail").setIntent(Intent.createChooser(mailIntent, "Mail Client"));
menu.add("SMS").setIntent(smsIntent);
menu.add("Contacts").setIntent(contactIntent);
menu.add("Market").setIntent(marketIntent);
return true;
}
}
Related examples in the same category