imageView = (ImageView) findViewById(R.id.*img*);
startBtn = (Button) findViewById(R.id.*startBtn*);
startBtn.setOnClickListener(*new* View.OnClickListener() {
*public* *void* onClick(View v) {
*final* CharSequence[] items = { "Take Photo", "Choose Existing" };
AlertDialog.Builder builder = *new* AlertDialog.Builder(
TakePicture.*this*);
AlertDialog alertDialog;
builder.setTitle("Select");
builder.setSingleChoiceItems(items, -1,
*new* DialogInterface.OnClickListener() {
*public* *void* onClick(DialogInterface dialog, *int* item) {
*if* (items[item] == "Take Photo") {
startCamera();
dialog.dismiss();
} *else* *if* (items[item] == "Choose Existing") {
Intent intent = *new* Intent();
intent.setType("image/*");
intent.setAction(Intent.*ACTION_GET_CONTENT*);
startActivityForResult(Intent.*createChooser*(intent, "Select Picture"), *
SELECT_PICTURE*);
dialog.dismiss();
}
}
});
alertDialog = builder.create();
alertDialog.show();
}
});
--
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