i’m following this tut
http://developer.android.com/resources/tutorials/views/hello-listview.html
and i was wondering how can i add the customView to the main.xml layout
the xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/main_title" />
<com.package.profile.view.HelloListView
android:id="@+id/listView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
the HelloListView class package is com.package.profile.view
i get error
01-30 16:00:38.875: E/AndroidRuntime(27614): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.package.profile/com.package.profile.ListDemoActivity}: android.view.InflateException: Binary XML file line #12: Class is not a View com.package.profile.view.HelloListView
Thanks.
The tutorial doesn’t extend a
View, but anActivity, more precisely aListActivity. Your main layout should be something like: