Problem resolved. Thanks for replying.
On Aug 7, 3:58 am, Shalin <[email protected]> wrote:
> Here, I am closing that ListView too.But still I am getting problem.In
> xml file I am writing EditText above ListView, that's showing EditText
> but when I am trying to setting or getting value in that EditText it's
> giving nullpointer exception
>
> On Aug 7, 3:44 am, Shalin <[email protected]> wrote:
>
>
>
> > But here I can access TextView in my code. Its isn't giving any error
> > or exception, But when I am trying to add EdtiText above ListView than
> > it's giving error. My actual XML as under. Declaration of LinearLayout
> > is Missing at very first.
>
> > <?xml version="1.0" encoding="utf-8"?>
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> > android"
> > android:layout_width="fill_parent"
> > android:layout_height="fill_parent"
> > android:orientation="vertical">
>
> > ******************I want EditText here*******************************
>
> > <ListView android:id="@+id/android:list"
> > android:layout_width="fill_parent"
> > android:layout_height="100dp"
> > android:background="#ffffff" android:layout_weight="3"
>
> > <TextView
> > android:id="@+id/str"
> > android:layout_width="fill_parent"
> > android:layout_height="wrap_content"
> > android:layout_weight="1"
> > android:background="#ecff20">
> > </TextView>
> > <TextView
> > android:id="@+id/count"
> > android:layout_width="fill_parent"
> > android:layout_height="wrap_content"
> > android:layout_weight="1"
> > android:background="#2f116f">
> > </TextView>
> > <LinearLayout xmlns:android="http://schemas.android.com/apk/
> > res/
> > android"
> > android:orientation="horizontal"
> > android:layout_width="fill_parent"
> > android:layout_height="wrap_content"
> > android:background="#cccccc"
> > android:textColor="#ffffff"
> > android:padding="3dp"
> > android:gravity="bottom"
> > android:layout_weight="1"
> > >
> > <EditText
> > android:id="@+id/txt"
> > android:layout_width="fill_parent"
> > android:layout_height="fill_parent"
> > android:background="@android:drawable/
> > editbox_background"
> > android:hint="Type to compose"
> > android:minHeight="30dp"
> > android:maxHeight="100dp"
> > android:layout_weight="1"
> > />
> > <Button
> > android:id="@+id/btn"
> > android:layout_width="120dp"
> > android:layout_height="fill_parent"
> > android:layout_weight="1"
> > android:text="Send SMS"
> > />
> > </LinearLayout>
> > </LinearLayout>
>
> > On Aug 7, 2:37 am, Gibson <[email protected]> wrote:
>
> > > The error is because you defined a TextView inside a ListView. You
> > > know ListView first is an AdapterView. You cannot add a view into
> > > AdapterView because it is not supported. What you can do is to define
> > > an Adapter(such as ArrayAdapter) then set the adapter into the
> > > ListView. Hope this can help you.
>
> > > On Aug 7, 12:57 pm, Shalin <[email protected]> wrote:
>
> > > > Hello friend, when I am adding editview in linearlayout I am getting
> > > > an error like this. My XML file as under. I am trying to add editview
> > > > above listview.
> > > > Error is
> > > > UnsupportedOperatioException: addView(View,LayoutParams) is not
> > > > supported in adapterview.
>
> > > > XMLfile:
> > > > <ListView android:id="@+id/android:list"
> > > > android:layout_width="fill_parent"
> > > > android:layout_height="100dp"
> > > > android:background="#ffffff" android:layout_weight="3" >
> > > > <TextView
> > > > android:id="@+id/str"
> > > > android:layout_width="fill_parent"
> > > > android:layout_height="wrap_content"
> > > > android:layout_weight="1"
> > > > android:background="#ecff20">
> > > > </TextView>
>
> > > > <TextView
> > > > android:id="@+id/count"
> > > > android:layout_width="fill_parent"
> > > > android:layout_height="wrap_content"
> > > > android:layout_weight="1"
> > > > android:background="#2f116f">
> > > > </TextView>
>
> > > > <LinearLayout
> > > > xmlns:android="http://schemas.android.com/apk/res/
> > > > android"
> > > > android:orientation="horizontal"
> > > > android:layout_width="fill_parent"
> > > > android:layout_height="wrap_content"
> > > > android:background="#cccccc"
> > > > android:textColor="#ffffff"
> > > > android:padding="3dp"
> > > > android:gravity="bottom"
> > > > android:layout_weight="1"
> > > > >
> > > > <EditText
> > > > android:id="@+id/txt"
> > > > android:layout_width="fill_parent"
> > > > android:layout_height="fill_parent"
> > > >
> > > > android:background="@android:drawable/editbox_background"
> > > > android:hint="Type to compose"
> > > > android:minHeight="30dp"
> > > > android:maxHeight="100dp"
> > > > android:layout_weight="1"
> > > > />
>
> > > > <Button
> > > > android:id="@+id/btn"
> > > > android:layout_width="120dp"
> > > > android:layout_height="fill_parent"
> > > > android:layout_weight="1"
> > > > android:text="Send SMS"
> > > > />
> > > > </LinearLayout>
>
> > > > </LinearLayout>
>
> > > > Thanks in advance
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---