Can anyone help me to complete the code below,here i want to view n edit 
the image appear on the thumbnail.i'm using imageview to take image as well 
as to view the captured image...thanx in advance

public class UserModule extends Activity {
protected static final int TAKE_PICTURE = 0;
protected static final int CAPTURE_PICTURE_CODE = 0;
protected static final int CAMERA_ACTIVITY = 0;
private static final String bm = null;
ImageView imgview;
private Intent intent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_layout);
 imgview=(ImageView) findViewById(R.id.imageView1);
imgview.setOnClickListener(new OnClickListener() {
 @Override
public void onClick(View arg0) {
if(imgview.getBackground() != null) {
Toast toast = Toast.makeText(getApplicationContext(),"Image taken", 
Toast.LENGTH_SHORT);
toast.show();
   try {
MediaStore.Images.Media.insertImage(getContentResolver(), bm, null, null);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
else{
 Toast toast = Toast.makeText(getApplicationContext(),"Image not taken", 
Toast.LENGTH_SHORT);
toast.show();

Intent intent = new 
Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, 
MediaStore.Images.Media.EXTERNAL_CONTENT_URI.toString());
startActivityForResult(intent, CAMERA_ACTIVITY);
 }

 }
});
}

 @Override
protected void onActivityResult(int requestCode, int resultCode, Intent 
data) {
    super.onActivityResult(requestCode, resultCode, intent);
    if (resultCode == RESULT_CANCELED) {
     Toast toast = Toast.makeText(getApplicationContext(),"Activity 
Cancelled", Toast.LENGTH_SHORT);
toast.show();
return;
    }
    switch(requestCode){
    case 0:
        if(resultCode==RESULT_OK){
           Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
           imgview.setImageBitmap(thumbnail);
           MediaStore.Images.Media.insertImage(getContentResolver(), 
thumbnail, null, null);
    }
   }
}

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to