score:1
Accepted answer
i just changed the code as following:
@override
public void onactivityresult(int requestcode, int resultcode, intent data) {
super.onactivityresult(requestcode, resultcode, data);
if (requestcode == pick_image && null != data) {
if (resultcode == getactivity().result_ok) {
selectedimage = data.getdata();
log.i("selectedimage", "selectedimage: " + selectedimage.tostring());
string[] filepathcolumn = {mediastore.images.media.data};
cursor cursor = getactivity().getcontentresolver().query(selectedimage,
filepathcolumn, null, null, null);
cursor.movetofirst();
int columnindex = cursor
.getcolumnindexorthrow(mediastore.images.media.data);
cursor.movetofirst();
log.i("columnindex", "columnindex: " + columnindex);
string picturepath = cursor.getstring(columnindex);
log.i("picturepath", "picturepath: " + picturepath);
cursor.close();
}
}
}
public void selectimagefromgallery(){
intent galleryintent = new intent(intent.action_pick,
android.provider.mediastore.images.media.external_content_uri);
startactivityforresult(galleryintent, pick_image);}
Source: stackoverflow.com
Related Query
- Image Upload using intent
- When I try to upload and save an image file using Struts in eclipse it shows the file name as null
- How to upload image files to Object Storage in Bluemix using Java Liberty on Eclipse?
- Browse for image file and display it using Java Swing
- how to upload image in base64 on server
- How to open Home Launcher List settings screen programmatically in Android using Intent
- Android: Error while using bitmap to display image using android studio
- Open an image in gallery using file path
- File Upload Using Selenium WebDriver and Java on a Mac
- JavaFx: how make a clickable image using scenebuilder
- File upload services using jersey in tomcat without maven
- upload image to google cloud storage with an application android
- Selenium webdriver upload download files using relative path
- Share intent in Android not sharing image to any app (after popup)
- to take a image using camera and use that as profile picture
- Android application crash after using action_view intent
- Image alligned not set in Center using FrameLayout
- How to upload file to a project directory using Spring MVC?
- Android Image Upload to server, HTTP Response is 200, but File is not uploaded
- Transforming image to Ascii code using conversion of grayVal to Ascii Character
- Unable to Upload Video File using Multipart Entity
- How to create GeoTagging image / location tagging application for android with google maps using eclipse with ADT
- Launch the Android x86 image on the target using ethernet
- intent using images android eclipse
- How can I bypass the Complete Action Using menu when using an implicit intent filter?
- GWT Image path capture using FileUpload and then storing the image as Blob in MySQL
- upload a project to Google App Engine created using Maven
- Android Image Slider using Viewpageindicator and UniversalImageLoader
- Add Image in background using default.css in eclipse e4
- Upload file via window prompt in Selenium WebDriver using AutoIt
More Query from same tag
- Array access producing unwanted result
- Build Success | Not Getting any error in Maven Project in Eclipse but nothing is happening
- Eclipse: including libraries with war file project
- Wrong fields in forms Alfresco exported from Activiti Kickstart
- Android emulator upside down in Eclipse Juno
- how to connect eclipse rcp application with mysql database
- Can an Eclipse-RCP based app do a "local" restore
- Getting started with Dropwizard
- How to debug Android App and Google-App-Engine projects simultaneously with Eclipse
- How can i deploy my worklight project to my blackberry device..?
- How can i set up Angular 2.0 workspace in eclipse kepler
- How to debug Java code running inside native code-created JVM?
- "gdstk.h No such file or directory"
- Eclipse product: Export multiple versions of a product which has slight variations
- Import JGraphT distribution to Eclipse
- Different behavior of mpiexec in Windows and in Ubuntu
- How do I get property type through xpath
- Eclipse adding project reference
- Running a Twisted Application in PyDev
- how to hide revision number from eclipse explorer view?
- Android List Color Scheme
- Exclude source directories from deployment to EAR/EJB module using Eclipse?
- Appendix C. - integration in Eclipse Mars.1
- How to search for overloaded methods in a class
- AVD rotates 90 degrees but the screen orientation does nothing
- Spring Tool Suite 3.6.2 cannot add server adapter Oracle Weblogic Server 10.3.5
- Eclipse juno giving error in Suse 64bit
- Bash script getting deleted automatically on OS X git repository inside Eclipse project
- How to search for a Java string in Eclipse?
- Eclipse Installs for nonexistent user