@@ -0,0 +1,2565 @@
+package com.example.ImageSharing;%0A%0Aimport android.app.Activity;%0Aimport android.content.Intent;%0Aimport android.content.pm.ActivityInfo;%0Aimport android.content.pm.PackageManager;%0Aimport android.content.pm.ResolveInfo;%0Aimport android.net.Uri;%0Aimport android.os.Bundle;%0A%0Aimport java.io.File;%0Aimport java.util.List;%0A%0Apublic class MyActivity extends Activity %7B%0A%0A    public static final String path = %22C:/Users/Kristoffer/Documents/Android/ImageSharing%22 +%0A            %22/res/drawable/spaceshipspacecityfutureclouds.jpg%22; //Full file path%0A%0A    @Override%0A    public void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.main);%0A        createShareIntent(path);%0A    %7D%0A%0A    private void createShareIntent(String pathToImage) %7B%0A        final PackageManager pm = getPackageManager();%0A        final Intent intent = new Intent(Intent.ACTION_SEND);%0A        if (pm != null) %7B%0A        List%3CResolveInfo%3E riList = pm.queryIntentActivities(intent, 0);%0A%0A            for (ResolveInfo ri : riList) %7B%0A                ActivityInfo ai = ri.activityInfo;%0A                if (ai != null) %7B%0A                    String pkg = ai.packageName;%0A%0A                    if (pkg.equals(%22com.facebook%22) %7C%7C pkg.equals(%22com.twitter%22)) %7B%0A                        //TTS apps available for sharing%0A%0A%0A                        // Add to the list of accepted activities.%0A%0A                        // There's a lot of info available in the%0A                        // ResolveInfo and ActivityInfo objects: the name, the icon, etc.%0A%0A                        // You could get a component name like this:%0A%0A                    %7D%0A                %7D%0A            %7D%0A            //Ask for user choice%0A            for (ResolveInfo ri : riList) %7B%0A                ActivityInfo ai = ri.activityInfo;%0A%0A                if (ai != null) %7B%0A                    //ComponentName cmp = new ComponentName(ai.packageName, ai.name);%0A%0A                    Intent shareIntent = new Intent(Intent.ACTION_SEND);%0A                    shareIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);%0A                    shareIntent.setType(%22image/*%22);%0A%0A                    // For a file in shared storage.  For data in private storage, use a ContentProvider.%0A                    File file = new File(pathToImage);%0A                    Uri uri = Uri.fromFile(file);%0A                    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);%0A                    shareIntent.setPackage(ai.packageName);%0A                    startActivity(shareIntent);%0A                %7D%0A            %7D%0A        %7D%0A    %7D%0A%7D%0A

Create MediaShare.java