hi there, i'm doing an application that displaying a list of guest
than will attending some event.
what i need to do is :
*to display all the Guest name in listView + checkbox + button
"attend" and "not attend" at the bottom of the list
*when user click the "attend " button, it will list all the checked
names.
*when click on "not attend" button, it will list all unchecked names.
to make it clear, i manage to do all those thing axcept for the
button action. i don't know how to capture the checked and unchecked
item..can anyone here help me with the code.i tried to find a tutorial
on that but still didn't find what i need yet.anyone please..
so here my codes:
public class CheckBox extends Activity {
private ListView lView;
private String lv_items[] = { "Annie", "Mark", "Mei Ling",
"Fujimaru", "Yukimura", "Andy",
"Emmy", "Christopher","Robert",
"Anthony", "Haruhi","Masaomi" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button btnSave = (Button) findViewById(R.id.Button01);
btnSave.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//Toast.makeText(getApplicationContext()," All Guest",
Toast.LENGTH_SHORT).show();
}
});
Button btnSave2 = (Button) findViewById(R.id.Button02);
btnSave2.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//Toast.makeText(getApplicationContext()," Attending",
Toast.LENGTH_SHORT).show();
}
});
Button btnSave3 = (Button) findViewById(R.id.Button03);
btnSave3.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
//Toast.makeText(getApplicationContext()," Not
Attending",
Toast.LENGTH_SHORT).show();
}
});
lView = (ListView) findViewById(R.id.ListView01);
//Set option as Multiple Choice. So that user can able to select more
the one option from list
lView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, lv_items));
lView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
}
and XML layout :
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:id="@+id/ListView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_weight="1.0" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
style="@android:style/ButtonBar">
<Button
android:id="@+id/Button01"
android:layout_width="105px"
android:layout_height="50px"
android:text="All"
android:textSize="12px"
android:layout_gravity="center_horizontal"
>
</Button>
<Button
android:id="@+id/Button02"
android:layout_width="105px"
android:layout_height="50px"
android:text="Attending"
android:textSize="12px"
android:layout_gravity="center_horizontal"
>
</Button>
<Button
android:id="@+id/Button03"
android:layout_width="105px"
android:layout_height="50px"
android:text="Not Attending"
android:textSize="12px"
android:layout_gravity="center_horizontal"
>
</Button>
</LinearLayout>
</LinearLayout>
And...thank you for helping me :)
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en