Nick Robertson
Nick Robertson

Reputation: 1047

Detect intent's type android

I have the following code:

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Share with...");
    final ShareAdapter adapter = new ShareAdapter(this, R.layout.share_adapter, activities.toArray());
    builder.setAdapter(adapter, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            ResolveInfo info = (ResolveInfo) adapter.getItem(which);


         }
     }

All I want to do is to add in the onClick method an if statement where I will check if the intent is of the following type: message/rfc822. Is there any way to do that? The reason that I want to do that Is because I want to detect the apps that are sending emails. And then to send an email with the following way:

    Intent intent = new Intent(android.content.Intent.ACTION_SEND);
    intent.setType("text/html");
    intent.putExtra(Intent.EXTRA_TEXT, Html.fromHtml(....

Upvotes: 1

Views: 559

Answers (1)

AlexVogel
AlexVogel

Reputation: 10621

How about Intents getType() method? Please see: http://developer.android.com/reference/android/content/Intent

Upvotes: 1

Related Questions