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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:31:32+00:00 2026-06-17T06:31:32+00:00

I have a MainActivity class which extends SlidingMenu . When the user clicks in

  • 0

I have a MainActivity class which extends SlidingMenu.

When the user clicks in the sliding menu on an item, I would like to reload the View(different layout and content) of MainActivity.

In most cases the new View would consiste of a ListView with customs cells.

Is it possible to do this when I create a MyListViewActivity inside MainActivity? Or does anyone have an idea how to solve this?

  • 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-17T06:31:33+00:00Added an answer on June 17, 2026 at 6:31 am

    The easiest way to do it (it all depends on your implementation) is just to use setContentView(R.layout.new_layout) on button click, which will inflate the other layout inside the same activity, replacing the old layout. BUT then be careful that all menus/action bars still get inflated, and that you don’t reference any widgets which exist on the old layout.

    If you want to have just a small section appear inside of your main layout, in your xml you could have something like:

    <ListView
        android:id="@+id/small_layout_1"
        android:visibility="visible"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    
     <LinearLayout
        android:id="@+id/small_layout_2"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" 
        android:visibility="gone" />
    

    then on the button press you find the reference to small_layout_1, make visibility=gone, find small_layout_2 and make visibility=visible, which will achieve the same behaviour I think you’re looking for

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

Sidebar

Related Questions

I have an activity ( MainActivity.java ) in which content view is like this
I have a class which creates a behindMenu for a Sliding Menu as follows:
I have 2 tabs, named : Tab1, Tab2 class MainActivity extends TabActivity. MainActivity.java public
I have the following class: public class MainActivity extends Activity { /** Called when
(I have got class MainActivity (extends Activity) and there I have got method setContentView(GameView);
I'm just starting out in android and I have my MainActivity class which has
I have two classes 1.MainActivity which extends Activity and 2.AlarmReceiver which extends BroadcastReceiver. How
I have MainActivity which extends SherlockListActivity. Here is onCreate method: public void onCreate(Bundle savedInstanceState)
In my MainActivity I have a class initialization like so: Presentation presentation = new
I have a class which extends ListActivity within I have all methods for managing

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.