in my application i'm retrieving image from sdcard and sending path of image back to previous activity.i'm not able to open image using that path.how can i do this.
code -
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
if(requestCode==1)
{
Uri path=data.getData();
File f;
System.out.println(";;;;;;;;;;;;"+path);//geting null
}
}
in 2nd activity-
for(j=1;j<idcount;j++){
if(ch[j].isChecked())
{
System.out.println("PPPPPPPPPPPPPPPPPP"+j);
i=new Intent();
i.putExtra("files",image[++j]);// image is array of file
setResult(RESULT_OK, i);
finish();
}
}
Have you tried using the getDataString() method?
Also I am not sure if this is completely what you want, but you could try doing something like:
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
Uri uri = (Uri)bundle.get(Intent.EXTRA_STREAM);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.