Android application chrashes after "share" intent

Posted by Johe Green on Stack Overflow See other posts from Stack Overflow or by Johe Green
Published on 2010-04-13T19:51:51Z Indexed on 2010/04/13 20:33 UTC
Read the original article Hit count: 364

Filed under:
|
|
|
|

Hi,

My app offers a "share/tell-a-friend" function. When the "share" button is pressed the following method is being called to open a list of apps, which can perform the action (Eg. Gmail, Twittroid, Facebook...):

public void share() {
   Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND);
   shareIntent.setType("text/plain");
   shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getText(R.string.menu_share_subject));
   shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, getText(R.string.menu_share_body));

   startActivity(Intent.createChooser(shareIntent, getText(R.string.menu_share_intent)));      
  }

The sharing functionality works basically. But when the sharing app (Facebook, Twitter, ...) tries to return to my app, a force close is thrown.

I guess that my app gets closed in the background during the sharing process... at least that is what the debugger sais...

Any ideas?

© Stack Overflow or respective owner

Related posts about android

Related posts about intent