public void onClick(DialogInterface dialog, int which) {
setContentView (R.layout.choose);
lv1 = (ListView) findViewById(R.id.options);
String[] lv_arr= new String [] {"Book a Classified Ad","Book a Classified display Ad","Book a display Ad","Page Position Availability", "MIS", "Market Share", "Approval", "Upload Material" };
ArrayList<String> Options = new ArrayList<String>();
Options.addAll(Arrays.asList(lv_arr));
listAdapter = new ArrayAdapter<String>(this, R.layout.choose, R.id.options);
lv1.setAdapter( listAdapter );
}
});
The Error it is giving is “The constructor ArrayAdapter(new DialogInterface.OnClickListener(){}, int, int) is undefined”
I am complete new in programing so please tell me how to change to the list view from Onclicklistner here ?
The
thisinrefers to a
DialogInterface.OnClickListenerclass. ArrayAdapter needs a pointer to an object that extends Context (ie an activity, preferably a listactivity).