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. Upgrade to Android 1.5 in Eclipse, but android library no longer recognized

Hi:

After I followed the steps necessary to upgrade to 1.5 SDK, I found
that eclipse no longer recognize the android libraries.  I "solved"
this via manually adding the android.jar to Java Build Path, but then
this creates the following problem:

[2009-05-31 22:59:04 - Tractor]
trouble processing "java/security/cert/CertPathParameters.class":
[2009-05-31 22:59:04 - Tractor]
Attempt to include a core VM class in something other than a core
library.
It is likely that you have attempted to include the core library from
a desktop
virtual machine into an application, which will most assuredly not
work. If
you really intend to build a core library -- which is only appropriate
as
part of creating a full virtual machine binary, as opposed to
compiling an
application -- then use the "--core-library" option to suppress this
error
message. If you go ahead and use "--core-library" but are in fact
building
an application, then please be aware that your build will still fail
at some
point; you will simply be denied the pleasure of reading this helpful
error
message.
[2009-05-31 22:59:04 - Tractor] 1 error; aborting
[2009-05-31 22:59:04 - Tractor] Conversion to Dalvik format failed
with error 1

Anybody has any advice on that?  Many thanks.

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

2. Testing among peers - A new group proposed

Hi,

I would like to propose a test exchange where few can test  apps for
others and vice versa. We can go by credit system where when you test
an app you get credits and use when your app is being tested by
others.

Or may be even have developers purchase the credits. Revenue can be
shared among testers and site operator.

More over we will get a real world test and feedback. We can code the
apps to function only for 30 days or so for test trials.

Please advice.
--~--~---------~--~----~------------~-------~--~----~

3. Disable 3G (UMTS) via code

4. How to listen for outside touch events for PopupWindow

5. Send files as MMS

6. building android for dream and for a new target

7. Sending data to an application running of device from host