problems removing childs from view

by DaRolla » Wed, 29 Apr 2009 18:11:03 GMT


Sponsored Links
 hello,

I have some problems removing views.

Inside my xml I have a LinearLayout with a ScrollView with a
TableLayout.

Into this I am adding (using Java) childs, which are LinearLayouts (no
TableRows).

This works fine.

Now I want to remove some childs, which are LinearLayouts.

linearlayout.setVisibility(View.GONE) works finde but doesnt remove
the Object itself.

tablelayout.removeView(linearlayout) works only under strange
circumstances: removing the last element of my list works fine.
removing some element in the middle throws this exception:

                                Uncaught handler: thread main exiting due to 
uncaught exception
                                java.lang.NullPointerException
                                at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1207)
                                at 
android.view.ViewGroup.drawChild(ViewGroup.java:1434)
                                at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
                                at android.view.View.draw(View.java:5571)
                                at 
android.widget.FrameLayout.draw(FrameLayout.java:324)
                                at 
android.view.ViewGroup.drawChild(ViewGroup.java:1436)
                                at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
                                at 
android.view.ViewGroup.drawChild(ViewGroup.java:1434)
                                at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
                                at 
android.view.ViewGroup.drawChild(ViewGroup.java:1434)
                                at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
                                at 
android.view.ViewGroup.drawChild(ViewGroup.java:1434)
                                at 
android.view.ViewGroup.dispatchDraw(ViewGroup.java:1208)
                                at android.view.View.draw(View.java:5465)
                                at 
android.widget.FrameLayout.draw(FrameLayout.java:324)

linearlayout.removeAllViews() I tried in order to clear all childs of
my linearlayout (which are some buttons and textviews in fact), but
this doesnt change anything.

Any idea what I am doing wrong?

Greetings,
DaRolla
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How can make Calendar in Android relate to my Gmail account?

Hi,
In Android 1.0 there's Calendar program,  when I try to run it, it
shows "Waiting for sync".  And there's no any gmail related apks to
log in gmail account. And I know Google won't open source Gmail apk
code.

What should I do to make sync run normally ?  Should I have to get
Gmail.apk from Google?

--~--~---------~--~----~------------~-------~--~----~

2. Curl for android

Any one know a function that acts like curl or wget does for linux?

--~--~---------~--~----~------------~-------~--~----~

3. How to display soft keyboard unlock screen for keyguard in cupcake

4. com.android.phone.InCallScreen activity

5. Debugging in Eclipse - current line wrong for methods with multiple return points

6. How to add more bluetooth profiles into android

7. Does Android support progressive download via methods other than chunked transfer coding?