hey guys i wanted to back to onActivityResult in previous activity
here is my code
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(DetailPhotoMedical.this, MedicalClaim.class);
Bundle extras = new Bundle();
// i.putExtra("photo", "");
extras.putString("photo","");
extras.putString("photoNo",photoNo);
i.putExtras(extras);
setResult(1000, i);
finish();
}
and i want to back to previous activity in onActivityResult
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode==1000)
{
Intent ii = getIntent();
Bundle extras = ii.getExtras();
photoFromDetail = extras.getString("photo");
photoNo = extras.getString("photoNo");
if (photoNo=="photo1")
{
strPhoto1="";
ivAttachment1.setImageResource(R.drawable.ic_menu_camera);
}
}
here is code to intent the 2nd acitvity
Intent i = new Intent(MedicalClaim.this, DetailPhotoMedical.class);
/* i.putExtra("photo", strPhoto1);*/
Bundle extras = new Bundle();
extras.putString("photo", strPhoto1);
extras.putString("photoNo","photo1");
i.putExtras(extras);
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
but the OnActivityResult didnt catch my resultcode
can you tell me whereis the wrong?
thx
Your question is not clear. You should describe more clearly about your case:
OnActivityResult
is not called.OnActivityResult
is called, but the resultCode
is not 1000.OnActivityResult
is called, resultCode
= 1000 but you cannot get extra data.For 2 first cases please make sure that you called startActivityForResult()
.
For 3rd case please remove this line Intent ii = getIntent();
and use the Intent
which is input parameter of onActivityResult
.