What is the error? I suspect you are getting a NullPointerException
here
>                         Bitmap thumbnail = (Bitmap) 
> data.getExtras().get("data");

Try debugging and you will get a hint.

The data returns a string that you should be converting to a Uri and
then create an image from that Uri.



On Nov 12, 3:23 am, Harris Swindell <[email protected]> wrote:
> Hey all -
>
> I am working on a program that opens up the camera on a button click,
> snaps a photo and takes that photo and stores it in a new class
> (listview.java) that will be accessed from the main menu.  My code to
> snap a pic is:
>
>         protected void onActivityResult(int requestCode, int resultCode,
> Intent data) {
>                 if (resultCode == RESULT_CANCELED) {
>                         showToast(this, "Scan Cancelled");
>                         return;
>                 }
>                 if (requestCode == CAMERA_PIC_REQUEST) {
>                         Bitmap thumbnail = (Bitmap) 
> data.getExtras().get("data");
>                         ImageView image = (ImageView) 
> findViewById(R.id.photoResultView);
>                         image.setImageBitmap(thumbnail);
>
>                 }
>         }
>
> how do I go about saving that new bmp file to that different class?
>
> I tried to put photoResultView in my listview.java class as so:
>
>                 TextView label = (TextView) rowView.findViewById(R.id.label);
>                 label.setText(names[position]);
>                 System.out.println(names[position]);
>                 // Change the icon for pics snapped, tester for later 
> implemntation
>                 if (names[position].startsWith("pic7")
>                                 || names[position].startsWith("Slut8")) {
>                         ImageView imageView = (ImageView) rowView
>                                         .findViewById(R.id.photoResultView);
>                         imageView.setImageResource(R.drawable.icon);
>                 }
>
> but the program crashes everytime I try and save the pic I snapped -
> anyone have any ideas or tutorials for doing this?
>
> Thanks!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to