Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7977527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:13:34+00:00 2026-06-04T09:13:34+00:00

When the view is removed, errors occurred, I can not find the cause of

  • 0

When the view is removed, errors occurred, I can not find the cause of the errors:

**java:**

  package com.test;
    import android.app.Activity;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.View;
    import android.view.ViewGroup;
    import android.view.animation.AlphaAnimation;
    import android.view.animation.Animation;
    import android.view.animation.Animation.AnimationListener;
    import android.widget.ImageView;

    public class AnimationActivity extends Activity {
        ImageView imageView = null;
        ViewGroup viewGroup = null;
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            imageView = (ImageView)findViewById(R.id.imageviewID);
            viewGroup = (ViewGroup)findViewById(R.id.layoutId); 
        }
        public void buttonOnclick(View e){
            int id = e.getId();
            if(id==R.id.alpha){
                AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0f);
                alphaAnimation.setDuration(5000);
                alphaAnimation.setStartOffset(500);
                alphaAnimation.setFillAfter(true);
                alphaAnimation.setFillBefore(false);
                alphaAnimation.setAnimationListener(new RemoveAnimationListener());
                imageView.startAnimation(alphaAnimation);
                Log.d("mydebug","imageView------------>"+imageView);
                Log.d("mydebug","viewGroup------------>"+viewGroup);
            }
        }
        private class RemoveAnimationListener implements AnimationListener{

            @Override
            public void onAnimationEnd(Animation animation) {
                // TODO Auto-generated method stub
                viewGroup.removeView(imageView);

            }
            @Override
            public void onAnimationRepeat(Animation animation) {
                // TODO Auto-generated method stub

            }

            @Override
            public void onAnimationStart(Animation animation) {
                // TODO Auto-generated method stub

            }
        }
    }

Here are errors:

  05-22 10:01:16.367: W/dalvikvm(1839): threadid=1: thread exiting with uncaught exception (group=0x4001d7c8)ss
    05-22 10:01:16.397: E/AndroidRuntime(1839): FATAL EXCEPTION: main
    05-22 10:01:16.397: E/AndroidRuntime(1839): java.lang.NullPointerException
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1366)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.View.draw(View.java:6743)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewGroup.drawChild(ViewGroup.java:1640)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewGroup.drawChild(ViewGroup.java:1638)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1367)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.View.draw(View.java:6743)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1857)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewRoot.draw(ViewRoot.java:1407)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.os.Handler.dispatchMessage(Handler.java:99)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.os.Looper.loop(Looper.java:123)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at java.lang.reflect.Method.invokeNative(Native Method)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at java.lang.reflect.Method.invoke(Method.java:521)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    05-22 10:01:16.397: E/AndroidRuntime(1839):     at dalvik.system.NativeStart.main(Native Method)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:13:37+00:00Added an answer on June 4, 2026 at 9:13 am

    You have use buttononclick method in your AnimationActivity class. So if you have
    mentioned which button click in your XML file then good. If you have not mention
    in XML which button is click, then you must mention in your activity which button
    click so that the corresponding method call is made. One more thing is that if it did not
    find view group so that it shows null pointer exception. You are trying to access or
    use view group which value is null or not found.

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/layoutId"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
    
        <ImageView android:id="@+id/imageviewID"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:src="@drawable/ic_launcher"
            android:contentDescription="@string/app_name"
            android:paddingBottom="50dip"
            />
        <Button android:id="@+id/alpha"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:text="@string/alpha"
            android:onClick="buttonOnclick"
            android:layout_below="@id/imageviewID"
            />
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I converted my app to ARC and removed all the pre-build release errors. It
When I point my browser to rails_app.com, I can view rails_app/public/index.html on the EC2
I can access the elmah.axd file, to view errors, when browsing using the localhost
How would I remove a view from this dialog? I know I can remove
By 'view' here I mean different combinations of properties of the model, not the
In my ASP.NET MVC app, I'm handling errors by overriding OnException in the controller.
The Issue : Errors in a php script cause white pages, no traces are
Creating a layout in Java as the number of TableLayouts required is not known
How to remove item from a list view? how to reload the list after
I want to remove if-statements from my View, but I'm having problems with predefined

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.