마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

버튼클릭 오류입니다 ㅠㅠ

0 추천
<span style="font-size: 11px;"><strong>public class </strong>MainActivity <strong>extends </strong>Activity {


    <span style="color: rgb(128, 128, 0);">@Override
</span><span style="color: rgb(128, 128, 0);">    </span><strong>protected void </strong>onCreate(Bundle savedInstanceState) {
        <strong>super</strong>.onCreate(savedInstanceState);
        setContentView(R.layout.<em>activity_main</em>);

        Button lampButton = (Button) findViewById(R.id.<em>lamp</em>);
        Button curtainButton = (Button) findViewById(R.id.<em>curtain</em>);
        Button boilerButton = (Button) findViewById(R.id.<em>boiler</em>);
        Button cameraButton = (Button) findViewById(R.id.<em>camera</em>);
    }


    <strong>public void </strong>onClick(View v) {
        <strong>switch </strong>(v.getId()) {
            <strong>case </strong>R.id.<em>lamp</em>:
                Intent intent = <strong>new </strong>Intent(getApplicationContext(), lampActivity.<strong>class</strong>);
                startActivity(intent);
                <strong>break</strong>;
            <strong>case </strong>R.id.<em>curtain</em>:
                Intent intent2 = <strong>new </strong>Intent(getApplicationContext(), curtainActivity.<strong>class</strong>);
                startActivity(intent2);
                <strong>break</strong>;
            <strong>case </strong>R.id.<em>boiler</em>:
                Intent intent3 = <strong>new </strong>Intent(getApplicationContext(), boilerActivity.<strong>class</strong>);
                startActivity(intent3);
                <strong>break</strong>;
            <strong>case </strong>R.id.<em>camera</em>:
                Intent intent4 = <strong>new </strong>Intent(getApplicationContext(), cameraActivity.<strong>class</strong>);
                startActivity(intent4);
                <strong>break</strong>;
        }
    }
}</span>

 

버튼 lamp curtain boiler 는 작동하는데 카메라가 작동을 안합니다 ㅠ

 

도깨비입술 (180 포인트) 님이 2016년 4월 23일 질문
도깨비입술님이 2016년 4월 23일 수정

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...