Wednesday 3 August 2011

textview cannot be resolved to a type

There is that weird stuff in android. I have list_item.xml which is below

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="?android:attr/listPreferredItemHeight"
></TextView>

and ArrayAdapter(view:View,textviewId:Int,items:String[]) wants a textview into 2nd parameter I was passing R.id.text1 as parameter but I needed to pass the layout (R.layout.list_item) instead of that textview. So why do you retrun 'textview cannot be resolved to a type' error to me? An example to confusing exceptions.

No comments: