0

I've a button which if clicked opens a alert dialog box with list of call logs. But only dialog box title is displayed on doing so.. Here is my code:

 protected void showCustomDialog() { // TODO Auto-generated method stub // this method returns the cursor with all call logs.. i've checked the cursor and it is returning. Cursor curLog = CallLogHelper.getAllCallLogs(getContentResolver()); // it fills the conNames arraylist with its values. setCallLogs(curLog); ListView listitems=new ListView(this); MyAdapter adapter = new MyAdapter( this , R.layout.dialog_list,conNames); //dialog_list is layout of each item of the list. alertDialogStores = new AlertDialog.Builder(MainActivity.this) .setView(listitems) .setTitle("Stores") .show(); } 
6
  • yes since ur code says only to display title what u r exceptiona lert to do? i mean any buttons? Commented Aug 17, 2014 at 16:15
  • i'm expecting the list of call logs. Do u want to see some other code? Commented Aug 17, 2014 at 16:17
  • what does setCallLogs do? give u string? Commented Aug 17, 2014 at 16:18
  • its fills the arraylist conNames with the call logs returned from getAllCallLogs Commented Aug 17, 2014 at 16:21
  • and conNames u wanna display as log ? Commented Aug 17, 2014 at 16:21

2 Answers 2

1

Write

listitems.setAdapter(adapter); 

after

ListView listitems=new ListView(this); MyAdapter adapter = new MyAdapter( this , R.layout.dialog_list,conNames); 
Sign up to request clarification or add additional context in comments.

Comments

1

You need to use below code for ur logs to be displayed :

use below code for forming string from arraylist something like this :

String msg=""; for(int i=0;i<conNames.size();i++) {msg=msg+" "+conNames;} alertDialogStores = new AlertDialog.Builder(MainActivity.this) .setView(listitems) .setTitle("Stores") .show(); .setMessage("my logs"+msg); 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.