Did you bother to look at the documentation?  An ArrayAdapter constructor
takes more than just one argument...  One of them happens to be the id of a
text view:

http://developer.android.com/reference/android/widget/ArrayAdapter.html#ArrayAdapter%28android.content.Context,%20int%29

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Thu, Mar 22, 2012 at 4:31 AM, Soyer <[email protected]> wrote:

> 03-22 06:23:21.295: E/AndroidRuntime(1941):
> java.lang.IllegalStateException: ArrayAdapter requires the resource ID
> to be a TextView
>
>
>
> the problem is in this couple of lines:
>
>  mNewDevicesArrayAdapter = new ArrayAdapter<String>(this,
> R.layout.textviewlayout);
>
>
>
>        // Find and set up the ListView for newly discovered devices
>       ListView newDevicesListView = (ListView)
> findViewById(R.id.new_devices);
>    //    TextView newDevicesListView = (TextView)
> findViewById(R.id.title_paired_devices);
>       newDevicesListView.setAdapter(mNewDevicesArrayAdapter);
>
>
> now when i try to set the arrayadapter for a list view, it says that
> the arrayadapter requires a textview, and this message appear asking
> to assign an ID for the textView though the ID is assigned, so i did
> is i put the textview in a separate file, however the arrayadapter is
> still assigned to a list view...when i try to assign it to a textview,
> the method setAdapter won't be in the list of the methods supported by
> the textview element.
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to