jeudi 1 janvier 2015

How to launch camera after pressing a button in android studio?


Vote count:

0




I'm a beginner in android studio. I created a dialogue view and there's the button which proceeds to camera activation. I couldn't figure out a way to activate it. I just want to activate the camera right after pressing the button. Here are my codes;


public class AddPictureDialog extends Dialog {



private Context context;

private Camera camera;


final Button takePhoto;

private DB myDB;
private SQLiteDatabase database;
private Person person = new Person();

public AddPictureDialog( Context context) {
super(context);
this.context = context;

setCanceledOnTouchOutside(false);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.addimage_layout);

camera = new Camera();


takePhoto = (Button) findViewById(R.id.takenewphoto);
takePhoto.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {

// Code here
}
});


}}


Thanks in advance,



asked 29 secs ago







How to launch camera after pressing a button in android studio?

Aucun commentaire:

Enregistrer un commentaire