Showing posts with label menu. Show all posts
Showing posts with label menu. Show all posts

Saturday, April 28, 2012

Android - Share Menu Feature

Intent intent = new Intent(android.content.Intent.ACTION_SEND);
intent.setType(“text/plain”);
intent.putExtra(android.content.Intent.EXTRA_TEXT, “Your Link”);
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, “Some extra text if you want it”);
startActivity(Intent.createChooser(intent, “Share via”));

Wednesday, September 21, 2011

Android: Hardware Menu button click event

The easiest way is to capture the onKeyDown event for the menu button click:



@Override
public boolean onKeyDown(int keycode, KeyEvent event ) {
 if(keycode == KeyEvent.KEYCODE_MENU)
{
  AlertDialog.Builder dialogBuilder
  = new AlertDialog.Builder(this)
  .setMessage("Test")
  .setTitle("Menu dialog");
  dialogBuilder.create().show();
 }
 return super.onKeyDown(keycode,event); 
}