I have this code i am used to pass an array list to another page and
show it as a listview. When the list shows up, i want to be able to
check an item and remove it at "button click" which will modify the
array.

public class Oppout extends Activity {
        int selectedPosition;
        /** Called when the activity is first created. */

        @Override
        public void onCreate(Bundle savedInstanceState) {

                      super.onCreate(savedInstanceState);
                      setContentView(R.layout.oppout);

                     final ListView lv2 = (ListView) findViewById
(R.id.custom_list_view);
                     lv2.setClickable(true);
                     lv2.setAdapter(new ArrayAdapter<String>(Oppout.this,
                                   android.R.layout.simple_list_item_checked,
Entername.playerList));

                     lv2.setOnItemClickListener
                     (
                        new AdapterView.OnItemClickListener()
                        {
                            public void onItemClick(AdapterView adapterView, 
View
view,int arg2, long arg3)
                            {
                               int selectedPosition =
adapterView.getSelectedItemPosition();

                               Toast.makeText(getBaseContext(), "mu"+
selectedPosition,
                                                   Toast.LENGTH_SHORT).show();

                            }
                        }
                     );


                        Button next = (Button) findViewById(R.id.button1);
                                next.setOnClickListener(new 
View.OnClickListener() {

                                        public void onClick(View view) {
                                        //on click call the adapterview and 
delete string at selected
position..this is my problem,
                                                //i just don't know how to do it
                                                 int selectedPosition = 
adapterView.getSelectedItemPosition();
                                                 
adapterView.remove(player.SelectedPosition);

                                                Intent myIntent = new Intent 
(view.getContext(),
Callacab.class);
                                                
startActivityForResult(myIntent, 0);

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