Stuck in getting camera snapshot when using Activity tab

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent,CAMERA_PIC_REQUEST); Intent takePictureIntent = new Intent(getParent(),TakePicture.class); takePictureIntent.putExtra("image",thumbnail); OpenBeeActivityGroup opentActivity = (OpenBeeActivityGroup)getParent(); opentActivity.startChildActivity("TakePicture Activity",takePictureIntent); 
+3
source share
2 answers

As I understand from your question, This happens when using an ActivityGroup . Since you start an Activity for the result inside the child Activity (i.e. TakePicture.class ), and Android will only allow one nested level of the child Activity (ies) (means that the child Activity cannot nest another child of the Activity ). You are probably processing the result in your child Activity ( TakePicture.class ).

So, the solution for your problem is to process this result inside the parent Activity ( OpenBeeActivityGroup ) onActivityResult() , and then send the result to the active Activity . you will use something like this. inside your baby. Run your startActivityForResult() from the parent Activity .

 getParent().startActivityForResult(cameraIntent,Global.CAMERA_PIC_REQUEST); 

and inside onActivityResult() ActivityGroup ( OpenBeeActivityGroup ):

 protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { switch(requestCode) { case Global.CAMERA_PIC_REQUEST: // global variable to indicate camera result Activity activity = getLocalActivityManager().getCurrentActivity(); activity.onActivityResult(requestCode, resultCode, data); break; } } } 
+10
source

In these lines, I tried to start the camera using your code, and if you really put it in it, you cannot call startActivityForResult again. What you need to do is extend the ActivityGroup to handle the start of the child action for the result. I should have understood this - HTH.

0
source

All Articles