Q:

Highlighting multiple items in a listview

I'm really struggling to highlight items in my listview - I want them to be highlighted onClick and un-highlighted when they are clicked again.  Can someone please help me achieve this for my code as I have looked at numerous bits of code online and can't get it to work - Thanks in advance!! Here is my code
    public class ConversationView extends Activity {
    TextView hello;

    Integer threadId;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_conversation_view);

        Intent intent = getIntent();
        String thread = intent.getStringExtra("threadId");

        threadId = Integer.parseInt(thread);

        final ListView convoListView = (ListView) this.findViewById(R.id.conversationListView);

        ArrayList<ConversationItem> convoItems = this.GetItems(threadId);

        final ConversionAdapter convoAdapter = new ConversionAdapter(getApplicationContext(), convoItems);

        convoListView.setAdapter(convoAdapter);

 convoListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
        convoListView.setItemChecked(1, true);
   }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_conversation_view, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

    public ArrayList<ConversationItem> GetItems(Integer threadId)
    {
        ArrayList<ConversationItem> convos = new ArrayList<>();
        convos.add(new ConversationItem(1, 1, "Bob Smith", DateTime.now(), "Lorem ipsum dolor sit amet, "));
        convos.add(new ConversationItem(1, 2, "Bob Smith", DateTime.now(), "Lorem ipsum dolor sit amet,Donec lacinia nunc sed faucibus suscipit. Curabitur."));
        convos.add(new ConversationItem(1, 3, "Bob Smith", DateTime.now(), "Lorem ipsum dolor sit amet, Curabitur."));
        convos.add(new ConversationItem(1, 4, "Bob Smith", DateTime.now(), "Lorem ipsum dolor sit amet, "));

        ArrayList<ConversationItem> returnItems = new ArrayList<>();

        for(int i = 0; i < convos.size(); i++)
        {
            if(convos.get(i).ThreadId.equals(threadId))
            {
                returnItems.add(convos.get(i));
            }
        }

        return returnItems;
    }

//this is my adapter

    public class ConversionAdapter extends ArrayAdapter<ConversationItem>
    {

        private final Context context;
        private final ArrayList<ConversationItem> items;
        private int currentPage = 0;

        public ConversionAdapter(Context context, ArrayList<ConversationItem> convoItems) {
            super(context, 0, convoItems);
            this.context = context;
            this.items = convoItems;
        }

}

A:

I'm just doing the same thing. This works for me.
I don't set the @drawable in listview, I have set it in format of listview i.e. in layout where you have put textViews and checkBoxes to be displayed in listview.
list_view_format.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/list_view_item">

</RelativeLayout>

/res/drawable/list_view_item.xml
<item android:state_pressed="true" >
    <shape>
        <solid android:color="@color/list_item_pressed"/>
    </shape>
</item>

<item android:state_activated="true" >
    <shape>
        <solid android:color="@color/list_item_activated"/>
    </shape>
</item>
<item>
    <shape>
        <solid android:color="@color/list_item_normal" />
    </shape>
</item>

/res/values/colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <color name="list_item_normal">#96ffdcb5</color>
    <color name="list_item_activated">#ffaa66</color>
    <color name="list_item_pressed">#ffaa66</color>
</resources>

