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 8046345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:45:36+00:00 2026-06-05T05:45:36+00:00

I am having a very weird exception!. First I reference to a Relative layout,

  • 0

I am having a very weird exception!. First I reference to a Relative layout, then i try to get its visibility state, but the activity crashes and throws a NullPointerException at getVisibilty();
I Have no idea why!, I spent a lot of time trying to figure out the problem but I couldn’t!,Here is my Activity code:

    setContentView(R.layout.main3d_activity);
    RelativeLayout optionLayout;
    optionLayout = (RelativeLayout) findViewById(R.id.main_optionLayout);
    int vis= optionLayout.getVisibility();

main3d_activity code:

    <?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/MainLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <include
        android:id="@+id/include_headerbar"
        android:layout_width="fill_parent"
        android:layout_height="60dp"
        layout="@layout/headerbar_layout" />
    <include
        android:id="@+id/include_footerbar"
        android:layout_width="fill_parent"
        android:layout_height="60dp"
        android:layout_alignParentBottom="true"
        layout="@layout/footerbar_layout" />

    <ViewFlipper
        android:id="@+id/vf"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/include_footerbar"
        android:layout_below="@+id/include_headerbar" >

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/container_mainlayout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/living_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/bedroom_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/childrenbedroom_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/kitchen_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/dinningroom_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/corridor_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/roof_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/garden_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/garage_layout" />

        <include
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            layout="@layout/container_mainlayout" />
    </ViewFlipper>

    <include
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_above="@+id/include_footerbar"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/include_headerbar"
        layout="@layout/slidingdrawer_infolayout" />

    <include
        android:layout_width="300dp"
        android:layout_height="400dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        layout="@layout/slidingdrawer_roomslistlayout" />

    <include
        android:layout_width="350dp"
        android:layout_height="300dp"
        android:layout_above="@+id/include_footerbar"
        android:layout_alignParentRight="true"
        layout="@layout/logger_layout" />

    <include
        android:id="@+id/include_relativeMenu"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/include_headerbar"
        layout="@layout/options_menulayout" />

</RelativeLayout>

options_menuLayout xml code:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_optionLayout"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="@drawable/main_headerbackground"
android:orientation="vertical"
android:visibility="invisible" >

<Button
    android:id="@+id/relativeMenuAllSensorsButton"
    android:layout_width="200dp"
    android:layout_height="50dp"
    android:layout_alignParentTop="true"
    android:background="@drawable/main_headerbackground"
    android:gravity="center_vertical|center_horizontal"
    android:text="Activation List"
    android:textColor="@android:color/white"
    android:textSize="18sp" />

<Button
    android:id="@+id/relativeMenuUsersButton"
    android:layout_width="200dp"
    android:layout_height="50dp"
    android:layout_below="@+id/relativeMenuAllSensorsButton"
    android:background="@drawable/main_headerbackground"
    android:gravity="center_vertical|center_horizontal"
    android:text="Users"
    android:textColor="@android:color/white"
    android:textSize="18sp" />

<Button
    android:id="@+id/relativeMenuPreferencesButton"
    android:layout_width="200dp"
    android:layout_height="50dp"
    android:layout_below="@+id/relativeMenuUsersButton"
    android:background="@drawable/main_headerbackground"
    android:gravity="center_vertical|center_horizontal"
    android:text="Settings"
    android:textColor="@android:color/white"
    android:textSize="18sp" />

I tried cleaning the project, rebuilding the workspace and even using different emulator but the same problem persists!

  • 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-05T05:45:37+00:00Added an answer on June 5, 2026 at 5:45 am

    In main3d_activity.xml you have:

    <include
        android:id="@+id/include_relativeMenu"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
         android:layout_below="@+id/include_headerbar"
        layout="@layout/options_menulayout" />
    

    And then in options_menulayout.xml you have:

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_optionLayout"
    

    So it looks like you’re overriding the id when you include it. Remove

        android:id="@+id/include_relativeMenu"
    

    from the include, or search for that ID rather than the other one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with jQuery's .get() function and I'm having a very weird problem using
I am having a very weird issue in the way strings get stored in
I having a very weird problem for my asp project. My project can run
I'm having a very weird issue in IE6. If I set a div container
Im having a very sneaky issue in Xcode and its Log Navigator. I've recreated
I am having a very weird problem that I've never had before when using
I'm having a very weird problem with a vector in my application. Details... I
I've been having some very weird problems. Yesterday I updated my master branch on
i having a very weird problem now . I has separate 2 jquery js
I'm having a very weird situation that is driving me nuts. I have a

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.