thank you so much for your reply ^_^
after many days..i managed to change my code but i still couldn't
manage to get the button works..i still don't know how to do it..i'm
not so clear with your explaination..its kind of hard for me to
imagine it with the codes..(i'm still a beginner.. i'm so sorry about
that..)here my code now..and i hope someone could help me with this..

looking forward for reply and i really appreciate any help from
anyone..
thank you for helping me..

public class MyGuestList extends Activity {
        private String[] lv_arr = {};
        private ListView mainListView = null;


        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);

                // Prepare an ArrayList of todo items
                ArrayList<String> guest = PrepareListFromXml();

                // Get a handle to the list view
                mainListView = (ListView) findViewById(R.id.ListView01);

                // Bind the data with the list
                lv_arr = (String[]) guest.toArray(new String[0]);
                mainListView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_multiple_choice, lv_arr));
                mainListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

//
==============================================================================
//my buttons
                Button btnSave = (Button) findViewById(R.id.Button01);
                btnSave.setOnClickListener(new OnClickListener() {
                        public void onClick(View v) {
                                //Toast.makeText(getApplicationContext()," You 
clicked Save
button", Toast.LENGTH_SHORT).show();

                                i don't know what to do to display the list of 
checked name here

                        }
                });
                Button btnClear = (Button) findViewById(R.id.Button02);
                btnClear.setOnClickListener(new OnClickListener() {
                        public void onClick(View v) {
                                //Toast.makeText(getApplicationContext()," You 
clicked Clear
button", Toast.LENGTH_SHORT).show();

                                i don't know what to do to display the list of 
Un-checked name
here too..

                        }
                });
//
==============================================================================
//this is my list
        }

                public ArrayList<String> PrepareListFromXml() {
                ArrayList<String> guest = new ArrayList<String>();
                try{

                        URL url = new URL(
                        
"http://tanjungrhu.jigsy.com/files/documents/MyList_1.xml";);
                        DocumentBuilderFactory dbf = 
DocumentBuilderFactory.newInstance();
                        DocumentBuilder db = dbf.newDocumentBuilder();
                        Document doc = db.parse(new 
InputSource(url.openStream()));
                        doc.getDocumentElement().normalize();

                        NodeList words = doc.getElementsByTagName("Guest");

                        for(int i=0;i<words.getLength();i++){
                                Node node = words.item(i);

                                Element fstElmnt = (Element) node;
                                NodeList NameList = 
fstElmnt.getElementsByTagName("Name");
                                Element NameElement = (Element) 
NameList.item(0);
                                NameList = NameElement.getChildNodes();
                                guest.add((((Node) 
NameList.item(0)).getNodeValue()));
                        }

        }
        catch (Throwable t){
                Toast.makeText(this, "Exeption:" + t.toString(), 2000).show();
        }
        return guest;
        }
}

and xml layout:

<?xml version="1.0" encoding="utf-8"?>
<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="wrap_content"
android:layout_height="wrap_content"
android:text="Attending">
</Button>

 <Button
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Not Attending">
</Button>
   </LinearLayout>
</LinearLayout>

On Apr 11, 5:41 am, TreKing <treking...@gmail.com> wrote:
> On Fri, Apr 8, 2011 at 11:37 PM, win <winwizardy...@gmail.com> wrote:
> > 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.
>
> First, "CheckBox" is the name of a standard widget - you should not name
> your Activity that.
>
> Second, when working with a list of data, you usually represent the data
> with your own data type that has the properties displayed in the list. In
> this case you might have a "Guest" class, which would have a boolean
> "attending" property. Each entry in the list would represent one Guest and
> would reflect the data stored in a Guest instance. When you want to show all
> attending or all not attending, you iterate through your list of Guests and
> find the ones with the relevant data. You also probably want to look at the
> Filter and Filterable interfaces in the docs to filter your listview based
> on some criteria.
>
> --------------------------------------------------------------------------- 
> ----------------------
> TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to