Hi experts, I would like to share a url from my android application. I would like to share this url through the installed applications in my device(bluetooth, facebook, google mail, messaging etc.).
Given below is the code
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class SendURL extends Activity {
/** Called when the activity is first created. */
Button button;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
button = (Button) findViewById(R.id.Button01);
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent picMessageIntent = new Intent(
android.content.Intent.ACTION_SEND);
picMessageIntent.setType("plain/text");
/**
* //Code for sending image
* picMessageIntent.setType("image/jpeg"); File downloadedPic =
* new
* File("/sdcard/download/"+"1287567819_Einstein_1_JPEG.jpg");
* picMessageIntent.putExtra(Intent.EXTRA_STREAM,
* Uri.fromFile(downloadedPic));
*/
startActivity(Intent.createChooser(picMessageIntent,
"Send your url using:"));
}
});
}
}
When I press a button called share, the installed applications in the phone which can share this url, should be listed like this. The user can select an application from this list and share the url through the chosen application(gmail, facebook, messaging etc.). With the given code, I get only gmail and bluetooth. I do not get facebook, messaging etc. Please advise, in order that I can send the url through all the applications in the phone which are capable of doing this.
Any help in this regard is appreciated. Looking forward, Regards