I am looking all day for this problem:
mUploadImage.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(
Intent.createChooser(intent, "Select a Picture"),
FILE_SELECT_CODE);
}
});
Whenever I click on the mUploadImage OnActivityResult () method, it starts immediately (although I still don’t select any file), and the result code is always 0. Can someone help me?
EDIT: (from the comment below)
protected void onActivityResult(int arg0, int arg1, Intent arg2) {
if (arg0 == FILE_SELECT_CODE) {
Log.v(TAG, "Selected a image. Result code: " + arg1);
if (arg1 == Activity.RESULT_OK) {
source
share