i wanna make an option on my account list that i block person(make it
disable) my problem is that i need a warning message to confirm the
operation;For example if I click it gives me a block account dialog
 !! O.o how to do it
code
import android.app.ListActivity;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class MainListActivity extends ListActivity  {

        private static final int ITEM_VIEW_TYPE_VIDEO = 0;
        private static final int ITEM_VIEW_TYPE_SEPARATOR = 1;
        private static final int ITEM_VIEW_TYPE_COUNT = 2;

        private static class Video {
                public String title;
                public String description;

                public Video(String title) {
                        this(title, "ok");
                }

                public Video(String title, String description) {
                        this.title = title;
                        this.description = description;
                }
        }

        private static final Object[] OBJECTS = { "Compte",
                        new Video("bloquer compte"), new Video("débloquer le 
compte "),
                        new Video("changer code de sécurité par sms "),
                        new Video("Virement par SMS "),
                        new Video("Annuler Virement par SMS "),
                        new Video("consulter votre solde  "),





                 "opération fiançiére",
                        new Video("paipement par sms "), new Video("recharge 
fix et GSM"),

                        new Video("chargement"), new Video("Transfer Spécial 
par SMS"),
                 "suvie"
                 };

        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.liste);

                setListAdapter(new VideoAdapter());
        }

        private class VideoAdapter extends BaseAdapter {

                @Override
                public int getCount() {
                        return OBJECTS.length;
                }

                @Override
                public Object getItem(int position) {
                        return OBJECTS[position];
                }

                @Override
                public long getItemId(int position) {
                        return position;
                }

                @Override
                public int getViewTypeCount() {
                        return ITEM_VIEW_TYPE_COUNT;
                }

                @Override
                public int getItemViewType(int position) {
                        return (OBJECTS[position] instanceof String) ?
ITEM_VIEW_TYPE_SEPARATOR
                                        : ITEM_VIEW_TYPE_VIDEO;
                }

                @Override
                public boolean isEnabled(int position) {
                        // A separator cannot be clicked !
                        return getItemViewType(position) != 
ITEM_VIEW_TYPE_SEPARATOR;
                }

                @Override
                public View getView(int position, View convertView, ViewGroup
parent) {

                        final int type = getItemViewType(position);

                        // First, let's create a new convertView if needed. You 
can also
                        // create a ViewHolder to speed up changes if you want 
;)
                        if (convertView == null) {
                                final LayoutInflater inflater =
LayoutInflater.from(MainListActivity.this);
                                final int layoutID = type == 
ITEM_VIEW_TYPE_SEPARATOR ?
R.layout.separator_list_item : R.layout.video_list_item;
                                convertView = inflater.inflate(layoutID, 
parent, false);
                        }

                        // We can now fill the list item view with the 
appropriate data.
                        if (type == ITEM_VIEW_TYPE_SEPARATOR) {
                                ((TextView) convertView).setText((String) 
getItem(position));
                        } else {
                                final Video video = (Video) getItem(position);
                                ((TextView) 
convertView.findViewById(R.id.title))
                                                .setText(video.title);
                                ((TextView) 
convertView.findViewById(R.id.description))
                                                .setText(video.description);
                        }

                        return convertView;
                }

        }
}

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