I ‘m trying to launch the camera app on button click but I don’t want to hav the fot
I want it to behave like it is launched by the lauc´ncher but when I call my code the application simply closes and the camera isn’t starting.There isn’t even an error code.
Code :
if(v == camera)
{
//Intent in=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
// this.startActivity(in);
Intent startupIntent = new Intent();
ComponentName distantActivity = new ComponentName("com.android.camera","com.android.camera/.Camera");
startupIntent.setComponent(distantActivity);
startupIntent.setAction(Intent.ACTION_MAIN);
startActivity(startupIntent);
finish();
}
use
android.intent.action.VIEWinstead ofIntent.ACTION_MAINas: