Ashish Patil
Ashish Patil

Reputation: 471

Android: how to send parsed xml data from list which contains text and checkbox on checkbox click

I have a ListView ,checkbox and text in one layout , In a different layout i have called the listview item by parsing it from xml using xml pull parser. how to send collectively the parsed data on click of checkbox. So that the parsed data should be sent depending on corresponding checkboxs checked. Please give me a detailed explanation. my parsing code is,

public void readxml() {
        try {
            InputStream is;

            is = getAssets().open("ash.xml");
            BufferedReader r = new BufferedReader(new InputStreamReader(is));
            StringBuilder total = new StringBuilder();
            String line;
            while ((line = r.readLine()) != null) {
                total.append(line);
            }
            parsexml(total.toString());
        } catch (Exception e) {
            // TODO: handle exception
        }
    }

    public void parsexml(String string) {

        ///// my parsing code 


}

Upvotes: 0

Views: 93

Answers (1)

Jitender Dev
Jitender Dev

Reputation: 6925

In order to send collective data you can use a bundle . below is an example of bundle and how to use it Create a bundle

    Bundle bundle=new  Bundle();
    bundle.putBoolean(key, value);
    bundle.putDoubleArray(key, value);
    bundle.putString(key, value);
    bundle.putCharSequence(key, value);

Send a bundle to an Activity

Intent intent = new
Intent(getApplicationContext(),SecondActivity.class);
intent.putExtra("android.intent.extra.INTENT", bundle);
startActivity(intent);

Get values from bundle

Bundle bundle = getIntent().getBundleExtra("android.intent.extra.INTENT");

Upvotes: 1

Related Questions