I have created a list view demo.list is created successfully and image are also added in right hand side properly. now i want when i click on a cross image in right side of row in list view,then that row will deleted.how to do this.

```
 public class MainActivity extends Activity {

            EditText editText;
            Button Button,Button1;
            ListView listView;
            ArrayList<String> listItems;
            BaseAdapter adapter;

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

                editText = (EditText) findViewById(R.id.editText);
              //  int pos = editText.getText().length();
                //editText.setSelection(pos);
                Button = (Button) findViewById(R.id.Button);
                listView = (ListView) findViewById(R.id.listview);
                //listView.setSelection(listView.getAdapter().getCount()-1);

                listItems = new ArrayList<String>();
                //listItems.add("First item");

                //code to only set the simple text in the listview
                //adapter = new ArrayAdapter<String>(this, R.layout., listItems);

                //Here is the creation of new anonymous class,because we can not create subclass inside any method so we create anonymous class inside the on create method
                adapter =new BaseAdapter() 
                {

                    @Override
                    public View getView(int arg0, View arg1, ViewGroup arg2)
                    {
                        // arg1 is the particular row position in list view weather the arg0 is the whole list view
                        // layout inflater for setting the text or an image on row in list view
                        LayoutInflater inflater = getLayoutInflater();
                        arg1 = inflater.inflate(R.layout.custom, null);
                        TextView textview = (TextView)arg1. findViewById(R.id.textView1);
                        textview.setText(listItems.get(arg0));
                        return arg1;
                    }

                    @Override
                    public long getItemId(int arg0) {
                        // TODO Auto-generated method stub
                        return 0;
                    }

                    @Override
                    public Object getItem(int arg0) {
                        // TODO Auto-generated method stub
                        return null;
                    }

                    @Override
                    public int getCount() {
                        // TODO Auto-generated method stub
                        return listItems.size();
                    }
                };

                listView.setAdapter(adapter);

                Button.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View v) {
                        listItems.add(editText.getText().toString());
                        adapter.notifyDataSetChanged();

                        // code to display the previous added text in front through edit text in
                        listView.setSelection(listView.getAdapter().getCount()-1);
                        //code to clear edit text after enter the text in list view
                        editText.getText().clear();
                          }
                         });

                listView.setOnItemClickListener(new OnItemClickListener() {
                    @Override
                    public void onItemClick(AdapterView<?> a, View v, int position,
                            long id) {
                        Toast.makeText(MainActivity.this, "Item has been added into your list", Toast.LENGTH_LONG)
                                .show();
                    }
                });

            }
        }

```