how to set listviewadapter in android custom dialog?

Posted by UMMA on Stack Overflow See other posts from Stack Overflow or by UMMA
Published on 2010-05-21T06:33:01Z Indexed on 2010/05/21 7:00 UTC
Read the original article Hit count: 690

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about android

Related posts about dialog