I have the below code:
ArrayList NumList = getIntent().getParcelableArrayListExtra ("number");
ArrayList MailList = getIntent().getParcelableArrayListExtra ("email");
// This array list will be updated each time.
mAdapter = new MyCustomAdapter();
mAdapter.addItem(Name);
if (!NumList.isEmpty()) {
mAdapter.addSeparatorItem("Phone");
mAdapter.addAll(NumList);
}
if (!MailList.isEmpty()) {
mAdapter.addSeparatorItem("Email");
mAdapter.addAll(MailList);
}
setListAdapter(mAdapter);
}
I want to be able to click on the list of numbers and call the selected number.
I am guessing you are using a ListActivity or ListFragment, so implement your calling logic in onListItemClick or place an onClickListener on each of the views when you create them in your custom adapter like so:
The logic for making a call looks like this:
Edit:
And remember add this CALL_PHONE permission to your Manifest: