tags:

views:

161

answers:

1

hi,

i am using following code to setlistview adapter but giving me error at last line

public class MyCustomDialog extends Dialog 
{
    String[] items= {"lorem", "ipsum", "dolor", "sit", "amet",
            "consectetuer", "adipiscing", "elit", "morbi", "vel",
            "ligula", "vitae", "arcu", "aliquet", "mollis",
            "etiam", "vel", "erat", "placerat", "ante",
            "porttitor", "sodales", "pellentesque", "augue", "purus"};

            TextView selection;


    public MyCustomDialog(Context context) 
    {
        super(context);

    }

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



ListView lst=(ListView)findViewById(R.id.mylist);

        lst.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, items));  

// error here The constructor ArrayAdapter<String>(MyCustomDialog, int, String[]) is undefined



    }

}

please guide what mistake am i doing? any help would be appreciated.

A: 

lst.setAdapter(new ArrayAdapter(this.getcontext(),android.R.layout.simple_list_item_1, items));

UMMA