[android-developers] Re: Gallery Intent to pick image --- Picasa-based images are invalid (Android 4.0+)

2012-01-26 Thread Mark Andrachek, Jr.
That workaround doesn't work for me.

 When I try getContentResolver().getInputStream(imageUri) on the
picasa URI's, I get (the picasa item id has been removed, FYI):

01-26 13:37:11.660: E/com.getpicture.MainActivity(9007):
java.io.FileNotFoundException: No content provider:
content://com.android.gallery3d.provider/picasa/item/
01-26 13:37:11.660: E/com.getpicture.MainActivity(9007):at
android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:
604)
01-26 13:37:11.660: E/com.getpicture.MainActivity(9007):at
android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:
536)
01-26 13:37:11.660: E/com.getpicture.MainActivity(9007):at
android.content.ContentResolver.openInputStream(ContentResolver.java:
371)

I've also tried:
ContentProviderClient client =
getContentResolver().acquireContentProviderClient(imageUri);
Log.e(this.getClass().getName(),client.getType(imageUri));

This gives a NPE, with an error message with a tag of
ActivityThread,
01-26 13:59:39.860: E/ActivityThread(10127): Failed to find provider
info for com.android.gallery3d.provider

On Jan 25, 11:43 am, Anton amkr...@gmail.com wrote:
 Workaround is here:

 http://jimmi1977.blogspot.com/2012/01/android-api-quirks-getting-imag...

 On Jan 8, 7:57 pm, John droidxl...@gmail.com wrote:







  I can confirm having this same bug only withpicasaimages on
  Honeycomb and ICS.

  Code:

  file = new File(getPath(intent.getData()));

  java.lang.RuntimeException: Failure delivering result
  ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://
  com.google.android.gallery3d.provider/picasa/item/
  5685218575016337410 }} to activity {MyActivity}:
  java.lang.NullPointerException
          at android.app.ActivityThread.deliverResults(ActivityThread.java:
  2976)
          at android.app.ActivityThread.handleSendResult(ActivityThread.java:
  3019)
          at android.app.ActivityThread.access$1100(ActivityThread.java:122)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
  1176)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:4340)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:511)
          at com.android.internal.os.ZygoteInit
  $MethodAndArgsCaller.run(ZygoteInit.java:784)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
          at dalvik.system.NativeStart.main(Native Method)
  Caused by: java.lang.NullPointerException
          at java.io.File.fixSlashes(File.java:185)
          at java.io.File.init(File.java:134)
          at MyActivity.onActivityResult(MyActivity.java:184)
          at android.app.Activity.dispatchActivityResult(Activity.java:4649)
          at android.app.ActivityThread.deliverResults(ActivityThread.java:
  2972)
          ... 11 more
  java.lang.NullPointerException
          at java.io.File.fixSlashes(File.java:185)
          at java.io.File.init(File.java:134)
          at MyActivity.onActivityResult(MyActivity.java:184)
          at android.app.Activity.dispatchActivityResult(Activity.java:4649)
          at android.app.ActivityThread.deliverResults(ActivityThread.java:
  2972)
          at android.app.ActivityThread.handleSendResult(ActivityThread.java:
  3019)
          at android.app.ActivityThread.access$1100(ActivityThread.java:122)
          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:
  1176)
          at android.os.Handler.dispatchMessage(Handler.java:99)
          at android.os.Looper.loop(Looper.java:137)
          at android.app.ActivityThread.main(ActivityThread.java:4340)
          at java.lang.reflect.Method.invokeNative(Native Method)
          at java.lang.reflect.Method.invoke(Method.java:511)
          at com.android.internal.os.ZygoteInit
  $MethodAndArgsCaller.run(ZygoteInit.java:784)
          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
          at dalvik.system.NativeStart.main(Native Method)

  Andrew wrote:
   Hello,

   I'm trying to launch a Gallery Intent to allow the user to select an
   image. The issue is that the code works on 2.x but fails occasionally
   on 4.x (I haven't tested 3.x). I've narrowed it down to issues
   specific toPicasa-sourced images. For example, from my google+ posts
   (still in the Gallery app).

   The problematic URI is content://
   com.google.android.gallery3d.provider/picasa/item/some ID.
   Attempting to retrieve the image local path gives me the error : W/
   GalleryProvider( 8091): unsupported column: _data

   My code is below:

   Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
   photoPickerIntent.setType(image/*);
   startActivityForResult(photoPickerIntent, PROFILE_PIC_RESULT);

   and then in onActivityResult(int requestcode, int resultcode, Intent
   data) :

 

Re: [android-developers] Selecting picasa photos in gallery

2011-10-25 Thread Mark Andrachek, Jr.
I've entered a bug:
http://code.google.com/p/android/issues/detail?id=21234


-- 
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] Selecting picasa photos in gallery

2011-10-24 Thread Mark Andrachek, Jr.
I'm running into something very similar trying to get thumbnails.
I use this to get select the image from the gallery:

Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType(image/*);
intent.putExtra(return-data, true);
startActivityForResult(Intent.createChooser(intent,Complete action 
using),PICK_FROM_GALLERY);

Then in the result:

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (resultCode != Activity.RESULT_OK)
  return;

   Uri contentUri = Uri.parse(data.getDataString());
   ListString parts = contentUri.getPathSegments();
   long id = Long.parseLong(parts.get(parts.size() - 1));
   Bitmap bitmap = MediaStore.Images.Thumbnails.getThumbnail(
  getActivity().getContentResolver(), 
  id, 
  MediaStore.Images.Thumbnails.MINI_KIND, 
  null
   );

}

If I log data.getDataString(), I get: 
content://com.android.gallery3d.provider/picasa/item/SOMEBIGNUMBER

And I get an exception thrown:
E/MiniThumbFile(26253): Got exception when reading magic, id = 
SOMEBIGNUMBER, disk full or mount read-only? class 
java.lang.IllegalArgumentException

Local images work fine, and have a different url:
content://media/external/images/media/115

I'm guessing SOMEBIGNUMBER is the PICASA_ID. How to get the thumbnail and/or 
image out of that, without falling back to accessing the picasa api's and 
having to have access to user account info... I wish I knew.

-- 
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