xml 소스입니다
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="check it out"/>
</LinearLayout>
------java 소스입니다.
package com.example.checkbox;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.CheckBox;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final CheckBox checkbox = (CheckBox) findViewById(R.id.checkbox);
checkbox.setOnClickListener(new OnClickListener(){
public void onClick(View v){
if(((CheckBox) v).isChecked()){
Toast.makeText(getApplicationContext(),"Selected",Toast.LENGTH_SHORT).show();
}else{
Toast.makeText(getApplicationContext(),"Not Selected",Toast.LENGTH_SHORT).show();
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
아예 어플실행이안되요ㅠㅠ sorry 뭐시긴가 하면서 실행이 안되네요..........
초보자라 해결을 못하겠습니다
도와주세요.. 에러도없고 워닝도 없습니다........