You can do this by sending an intent for the image gallery.
first fire the intent:
Using java Syntax Highlighting
Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(i, 1);
Parsed in 0.031 seconds, using
GeSHi 1.0.8.4
with this code you fire an intent to open the imagegallery.
and you start the activity to get a result (your image)
After this you got to capture the result (the selected image) from the imagegallery:
Using java Syntax Highlighting
//implement the onActivity for result method
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if(resultCode == RESULT_OK){
Uri selectedImage = intent.getData();
String [] proj={MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery(selectedImage,proj,null,null,null);
int column_index = cursor.getColumnIndexOrThrow(proj[0]);
cursor.moveToNext();
String filePath = cursor.getString(column_index);
bitmap = BitmapFactory.decodeFile(filePath);
//bitmap = youre image
}
else if (resultCode == RESULT_CANCELED) {
}
}
Parsed in 0.032 seconds, using
GeSHi 1.0.8.4