public void cameraIntent(Context context)
{
Intent takingPictureCameraintent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
((AppCompatActivity)context).startActivityForResult(takingPictureCameraintent, REQUEST_CAMERA);
}
}
這是我的onActivityResult():onActivityResult並沒有叫
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == Activity.RESULT_OK) {
if (requestCode == SELECT_FILE)
onSelectFromGalleryResult(data);
else if (requestCode == REQUEST_CAMERA)
onCaptureImageResult(this,data);
}
}
onActivityResult()不被調用。我該怎麼辦?
你是從片段還是活動中調用? –
我想你是從片段調用它..如果是這樣,然後嘗試調用沒有......((AppCompatActivity)上下文)。 –
nops ..從AppCompatActivity調用@sourabhbans –