[android-developers] How do i multi select images in the Gallery and send there URL to my activity?

2010-12-22 Thread Hans-Erik
hi
In the gallery I have added my Item to the share menu. But i can only
get one image and making my Activity start. This code give me the URL
for one image. Is it possible to set up the Gallery or the share menu
so that user can select one or many pictures?

if (Intent.ACTION_SEND.equals(action))
{ if extras.containsKey(Intent.EXTRA_STREAM))
{ Uri uri = (Uri)extras.getParcelable(Intent.EXTRA_STREAM); 
//path
to image
Toast toast = Toast.makeText(this, path: +
getRealPathFromURI(uri),
Toast.LENGTH_SHORT); toast.show();
return;
} else if
(extras.containsKey(Intent.EXTRA_TEXT)) {
}

} public String getRealPathFromURI(Uri contentUri) { String[] proj =
{
MediaStore.Images.Media.DATA }; Cursor cursor =
managedQuery(contentUri,
proj, null, null, null); int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst(); return cursor.getString(column_index);
}

intent-filter
action android:name=android.intent.action.SEND /
category 
android:name=android.intent.category.DEFAULT /

data android:mimeType=image/* /
/intent-filter

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


[android-developers] How do i multi select images in the Gallery and send there URL to my activity?

2010-12-22 Thread Hans-Erik
hi
In the gallery I have added my Item to the share menu. But i can only
get one image and making my Activity start. This code give me the URL
for one image. Is it possible to set up the Gallery or the share menu
so that user can select one or many pictures?

if (Intent.ACTION_SEND.equals(action))
   { if extras.containsKey(Intent.EXTRA_STREAM))
   { Uri uri = (Uri)extras.getParcelable(Intent.EXTRA_STREAM);
  Toast toast = Toast.makeText(this, path:
+getRealPathFromURI(uri),
  Toast.LENGTH_SHORT); toast.show();
  return;
   } else if
   (extras.containsKey(Intent.EXTRA_TEXT)) {
   }

 }

public String getRealPathFromURI(Uri contentUri) { String[] proj =
{
   MediaStore.Images.Media.DATA };
   Cursor cursor = managedQuery(contentUri,proj, null, null, null);
   int column_index =
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
   cursor.moveToFirst();
   return cursor.getString(column_index);
}

   intent-filter
 action android:name=android.intent.action.SEND /
 category android:name=android.intent.category.DEFAULT /
 data android:mimeType=image/* /
   /intent-filter

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


Re: [android-developers] How do i multi select images in the Gallery and send there URL to my activity?

2010-12-22 Thread Mark Murphy
ACTION_SEND only supports sending one item.

On Wed, Dec 22, 2010 at 12:45 PM, Hans-Erik erikswed...@gmail.com wrote:
 hi
 In the gallery I have added my Item to the share menu. But i can only
 get one image and making my Activity start. This code give me the URL
 for one image. Is it possible to set up the Gallery or the share menu
 so that user can select one or many pictures?

 if (Intent.ACTION_SEND.equals(action))
        { if extras.containsKey(Intent.EXTRA_STREAM))
                { Uri uri = (Uri)extras.getParcelable(Intent.EXTRA_STREAM); 
 //path
 to image
                                Toast toast = Toast.makeText(this, path: +
 getRealPathFromURI(uri),
                                Toast.LENGTH_SHORT); toast.show();
                                return;
                } else if
                        (extras.containsKey(Intent.EXTRA_TEXT)) {
 }

 } public String getRealPathFromURI(Uri contentUri) { String[] proj =
 {
                MediaStore.Images.Media.DATA }; Cursor cursor =
 managedQuery(contentUri,
                proj, null, null, null); int column_index =
                cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
                cursor.moveToFirst(); return cursor.getString(column_index);
 }

                intent-filter
                        action android:name=android.intent.action.SEND /
                        category 
 android:name=android.intent.category.DEFAULT /

                    data android:mimeType=image/* /
                /intent-filter

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




-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 1.9
Available!

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