i made news applicaion in android using RSS feed and now i want to share some news ie i want to upload links from my app to facebook, t开发者_如何学编程witter etc.Is it possible? Thanks
Try this :
findViewById(R.id.btnEnvoyer).setOnClickListener(
new Button.OnClickListener() {
public void onClick(View v) {
Intent sendMailIntent = new Intent(Intent.ACTION_SEND);
sendMailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.Share_Mail_Subject));
sendMailIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.Share_Mail_Text));
sendMailIntent.setType("text/plain");
startActivity(Intent.createChooser(sendMailIntent, "Email / SMS / Tweet ?"));
}
}
);
works just fine in my latest app if you want to test it : Comis Strips in Brussels
=> Hit [Menu], then [Share], then the button [Send Email / SMS / Tweet]=R.id.btnEnvoyer in my layout file to see the alternatives the user can choose from ...
Hope this helps you a bit ...
H.
Yes it is. Twitter and Facebook has api for you to do those. Take a look at these Twitter Java APIs also checkout the facebook developer page
精彩评论