Thursday, January 19, 2012

sharing content on web using shareIntent in android



When you are click on image button than sharing dialog is open.
code here..........
shareButton.setOnClickListener(new OnClickListener() {


@Override
public void onClick(View v) {
Toast.makeText(mcontext,"click", Toast.LENGTH_SHORT).show();


//create the intent

Intent shareIntent = 
 new Intent(android.content.Intent.ACTION_SEND);

//set the type
shareIntent.setType("text/plain");

//add a subject
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, 
 "Insert Subject Here");

//build the body of the message to be shared
String shareMessage = "Insert message body here.";

//add the message
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, 
 shareMessage);

//start the chooser for sharing
startActivity(Intent.createChooser(shareIntent, 
 "Insert share chooser title here"));


}
});




3 comments:

  1. Nice to get about your blog details.As we know Android is one of the well known mobile application.This is one of the pleasurable information.

    ReplyDelete
  2. I have apparent progression in every post. Your newer posts are artlessly admirable compared to your posts in the past. Keep up the acceptable work.

    Android developers

    ReplyDelete