tags:

views:

26

answers:

0

Hi,

I have registered the appropriate intents in my manifest and my app pops up as a possible viewer when I click any email message in the message list. If I choose my app as the message reader the intent is registered in intent.getAction() in my app but I am lost from there as I cannot extract the message body no matter what I try. The debugger picks up the content as content://mail/messages/47 but the cursor object fails with index -1 out of bounds?

    Uri data;
    String message;
    final Intent intent = getIntent();
    final String action = intent.getAction();

    if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_VIEW.equals(action)) {

     data=intent.getData();         
     Cursor cur = managedQuery(data, null, null, null, null);
     message = cur.getString(cur.getColumnIndex("body"));  
 }