Get full accessable path from Android Gallery -
i need access file android gallery , upload url using post.
there no problem. new stuff accessing device data. need have hint full path of image selected gallery using intent , startactivityforresult.
startactivityforresult(new intent(intent.action_pick, android.provider.mediastore.images.media.internal_content_uri), select_image);
to fetch images on sd card.uri be
android.provider.mediastore.images.media.external_content_uri
onactivityresult method:
protected void onactivityresult(int requestcode, int resultcode, intent intent) { super.onactivityresult(requestcode, resultcode, intent); if (resultcode == result_ok) { uri photouri = intent.getdata(); if (photouri != null) { try { bitmap bitmap = mediastore.images.media.getbitmap(this .getcontentresolver(), photouri); //now can upload bitmap server or else. } catch (exception e) { e.printstacktrace(); } } } }
Comments
Post a Comment