I use this intent to open Gmail message but i think i need to add in extra some info about id and i don't know Keys for extra.
Intent gmintent = new Intent(Intent.ACTION_VIEW);
gmintent.setClassName("com.google.android.gm", "com.google.android.gm.HtmlConversationActivity");
gmintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(gmintent);
to ZZZZZZZover9000
public class MessageListClickListner implements OnItemClickListener{
private Context context;
private List<Map<String, String>>开发者_JS百科 groupOfChilds;
public MessageListClickListner(Context context, List<Map<String, String>> groupOfChilds) {
super();
this.context = context;
this.groupOfChilds = groupOfChilds;
}
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
if("sms".equalsIgnoreCase(groupOfChilds.get(position).get("TYPE"))){
Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("content://mms-sms/conversations/"+groupOfChilds.get(position).get("ID")));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}else{
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_SUBJECT,"Email subject");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Body of Email");
sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(Intent.createChooser(sendIntent, "Email:"));
/* Intent gmintent = new Intent(Intent.ACTION_VIEW);
// gmintent.putExtra("id", groupOfChilds.get(position).get("ID"));
gmintent.setClassName("com.google.android.gm", "com.google.android.gm.HtmlConversationActivity");
gmintent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(gmintent);*/
}
}
}
Published solution at: How to open a particular message/conversation in the Gmail app
Try this:
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_SUBJECT,"Email subject");
sendIntent.putExtra(Intent.EXTRA_TEXT, "Body of Email");
startActivity(Intent.createChooser(sendIntent, "Email:"));
The user will get to choose which email client to use.
Try this:
gmintent.putExtra("key", "value");
精彩评论