Hi All,

I want to share image from my application i am using following code to
do that:

Intent picMessageIntent = new
Intent(android.content.Intent.ACTION_SEND);
picMessageIntent.setType("image/jpeg");

File downloadedPic =  new File(
    Environment.getExternalStoragePublicDirectory(
    Environment.DIRECTORY_DOWNLOADS),
    "q.jpeg");

picMessageIntent.putExtra(Intent.EXTRA_STREAM,
Uri.fromFile(downloadedPic));
startActivity(picMessageIntent);
startActivity(Intent.createChooser(picMessageIntent, "Send your
picture using:"));

Now this launches all the apps which support image sharing but if i
want to exclude some applications like twitter how should i do it?

I proceeded with following code:
PackageManager pm = getPackageManager();
List<ResolveInfo> matches = pm.queryIntentActivities(intent, 0);

The list gives me all the applications which could be invoked.

But i can't proceed from here.


I can set the class name of the intent using following code and can
only make this application send images like gmail.

ResolveInfo best = null;
        for (final ResolveInfo info : matches)
            if (info.activityInfo.packageName.endsWith(".gm")
                    ||
info.activityInfo.name.toLowerCase().contains("gmail"))
                best = info;
        if (best != null)
            intent.setClassName(best.activityInfo.packageName,
best.activityInfo.name);
        startActivity(intent);

But excluding one application is the problem. can anybody help me .


Regards
Subrat

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to