I create a list but I don't know how to create a sublist it mean when
the user taps on such account there is another list
here is my list
package com.tutomobile.android.listView;

import java.util.ArrayList;
import java.util.HashMap;

import com.tutomobile.android.listView.R;

import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;


import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

public class Tutoriel5_Android extends Activity {

        private ListView maListViewPerso;


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


        maListViewPerso = (ListView) findViewById(R.id.listviewperso);


        ArrayList<HashMap<String, String>> listItem = new
ArrayList<HashMap<String, String>>();


        HashMap<String, String> map;


        map = new HashMap<String, String>();

        map.put("titre", "compte");
        map.put("description", "information sur compte  ");


        listItem.add(map);



        map = new HashMap<String, String>();
        map.put("titre", "opération");
        map.put("description", "les opérations ");

        listItem.add(map);

        map = new HashMap<String, String>();
        map.put("titre", "suvui ");
        map.put("description", "suvui de compte ");

        listItem.add(map);




        SimpleAdapter mSchedule = new SimpleAdapter
(this.getBaseContext(), listItem, R.layout.affichageitem,
               new String[] {"img", "titre", "description"}, new int[]
{R.id.img, R.id.titre, R.id.description});


        maListViewPerso.setAdapter(mSchedule);


        maListViewPerso.setOnItemClickListener(new
OnItemClickListener() {
                        @Override
                @SuppressWarnings("unchecked")
                public void onItemClick(AdapterView<?> a, View v, int
position, long id) {

                        HashMap<String, String> map = (HashMap<String, String>)
maListViewPerso.getItemAtPosition(position);

                        AlertDialog.Builder adb = new
AlertDialog.Builder(Tutoriel5_Android.this);

                        adb.setTitle("Sélection Item");

                        adb.setMessage("Votre choix : "+map.get("titre"));

                        adb.setPositiveButton("Ok", null);

                        adb.show();
                }
         });

    }
}

-- 
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

Reply via email to