1

I'm trying to take apicture and I want to pass this picture to another activity to be displayed in it.

    OnClickListener listener_TakePic = new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(intent, CAMERA_PIC_REQUEST);
        }
    };

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == CAMERA_PIC_REQUEST && resultCode == RESULT_OK) {
           Bitmap image = (Bitmap) data.getExtras().get("data");    
        }// End IF
    }// End of Method


Please tell me what should I do or modify to achieve what I want..

Actually, i have created an application class "base class" in which, I have defined an "bitmap cameraPic" and "static final int CAMERA_PIC_REQUEST = 1;"

Now, I have an activity classed named "AddLocation" from which I call startActivityForResult(intent, CAMERA_PIC_REQUEST);

but I want the result of the camera Picture to appear in another activity called "MPActivity"

My question is, should I call "onActivityResult(int requestCode, int resultCode, Intent data)" method from "MPActivity" or there is no need to call it...

i'm really confused please clarify..

1 Answers1

0

There are more than one way to tackle the task you are doing.

  1. you can build a java class and put populates its one of property by the desired image. Then you can just get stuff that into an arraylist and pass that to a global arraylist.
  2. you can use Application class and make a global image variable that can be accessed in every class in your activity.

etc ...

Relsell
  • 771
  • 6
  • 18
  • can u tell me how to use Application class and make a global image variable that can be accessed in every class in your activity. –  Feb 14 '12 at 15:37
  • go through this link on so http://stackoverflow.com/questions/4208886/using-the-android-application-class-to-persist-data – Relsell Feb 14 '12 at 15:45