문제 설명
안드로이드에서 버튼 클릭시 커스텀 카메라 실행 (custom camera launch on button click in android)
내 앱에서 버튼을 클릭할 때 내 사용자 지정 카메라를 열고 싶습니다. 도와주세요.
미리 감사합니다:)
private static Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
OnClickButtonListener();
}
public void OnClickButtonListener() {
button = (Button) findViewById(R.id.camerabutton);
button.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto‑generated method stub
Intent intent =new Intent ("com.example.hrbl.camera");
startActivity(intent);
}
});
참조 솔루션
방법 1:
If it's an activity inside the app then try this
Intent intent =new Intent (MyAcitivty.this, CustomCameraActivity.class);
startActivity(intent);
Just change the activity names so they fit yours
(by Al Kenon、Andy Joyce)