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

  • Home
  • SEARCH
  • 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 8231301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:26:26+00:00 2026-06-07T17:26:26+00:00

Hey i’m trying to use ViewAnimator and i probably am missing something basic. This

  • 0

Hey i’m trying to use ViewAnimator and i probably am missing something basic.
This is what i have :

        va = new ViewAnimator(this);
    va.setInAnimation(inFromLeftAnimation());
    va.setOutAnimation(outToRightAnimation());

    RelativeLayout stage = (RelativeLayout)findViewById(R.layout.american_stage);
    va.addView(stage,0);


    setContentView(va);

Where inFromLeftAnimation and outToRightAnimation just handles animations and works perfectly.
And ofcourse that the file really exists…
I Get this log :

   07-13 15:45:14.515: E/AndroidRuntime(564): java.lang.RuntimeException: Unable to start activity ComponentInfo{shibby.webhunt/shibby.webhunt.ArcadeModeActivity}: java.lang.NullPointerException
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.os.Looper.loop(Looper.java:123)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-13 15:45:14.515: E/AndroidRuntime(564):  at java.lang.reflect.Method.invokeNative(Native Method)
07-13 15:45:14.515: E/AndroidRuntime(564):  at java.lang.reflect.Method.invoke(Method.java:521)
07-13 15:45:14.515: E/AndroidRuntime(564):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-13 15:45:14.515: E/AndroidRuntime(564):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-13 15:45:14.515: E/AndroidRuntime(564):  at dalvik.system.NativeStart.main(Native Method)
07-13 15:45:14.515: E/AndroidRuntime(564): Caused by: java.lang.NullPointerException
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.view.ViewGroup.addView(ViewGroup.java:1815)
07-13 15:45:14.515: E/AndroidRuntime(564):  at shibby.webhunt.ArcadeModeActivity.onCreate(ArcadeModeActivity.java:25)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-13 15:45:14.515: E/AndroidRuntime(564):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)

And i have no idea why.
Is it impossible to use XML files as views? do i have to build the views myself?

  • 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-07T17:26:28+00:00Added an answer on June 7, 2026 at 5:26 pm
    07-13 15:45:14.515: E/AndroidRuntime(564): Caused by: java.lang.NullPointerException
    07-13 15:45:14.515: E/AndroidRuntime(564):  at android.view.ViewGroup.addView(ViewGroup.java:1815)
    

    It looks like you are trying to add a View (RelativeLayout stage) that is null, I don’t believe you can load a layout with findViewById():

    findViewById(R.layout.american_stage);
    

    If you are trying to open a non-visible layout in american_stage.xml, use a LayoutInflater:

    LayoutInflater layoutInflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);  
    stage = layoutInflater.inflate(R.layout.american_stage, null);  
    

    Or if you are trying to load an already visible RelativeLayout:

    1) Give the RelativeLayout the id american_stage

    <RelativeLayout 
        android:id="@+id/american_stage"
        ...
    

    2) And use:

    findViewById(R.id.american_stage);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys having this really simple problem but cant seem to figure out have
hey guys I have the follow code in js: $(document).ready(function(){ $(.replyLink).click(function(){ $(#form-to-+this.id).html(htmlForm()).toggle(500); return false;
Hey everyone I have a basic search function here that allows me to search
Hey all i have an XML file that i am trying to loop though.
Hey all i am probably overthinking this but how can i check the textbox
Hey guys, I am trying to have a theme set up and be able
hey all.i'm newbie at this problem.i have this data in table result: item range_code
Hey i have been looking around and i cant find a way to get
Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
*Hey , I have finished developing my app In my iphone apps I have

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.