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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:47:38+00:00 2026-05-30T23:47:38+00:00

In my app i want to change the Activity contentview if a button was

  • 0

In my app i want to change the Activity contentview if a button was clicked for example.

In the begining i call the first layou:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.catalog);
    }

and when a button was pressed i call this one:

    public void showItemActivity(int position){
        setContentView(R.layout.item_view);
    }

and in this method my app crash.

i need to say that if i try this method:

setContentView(R.layout.item_view);

in the begin of another Activity it work perfectly, but it reali important for me that it will be in the same Activity.

Edit

the logchat error msg:

 java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'
  • 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-05-30T23:47:39+00:00Added an answer on May 30, 2026 at 11:47 pm

    The problem is that your activity class may have extended ListActivity, and you should have a ListView whose id attribute is android.R.id.list in your layout xml file, so that your ListActivty class can find the main list of this activity.(if someClass extends ListActivity, it means that someClass, mainly has the role of a list). Just set your ListView id to android.R.id.list in layout/item_view.xml.

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

Sidebar

Related Questions

I want to change the language in my app programatically. The first onCreate(Bundle) method
I want to change a button color in my app by selecting color. Instead
I want to change my radio button text in android app with a value
In onListItemClick I want to change clicked item background, this is my code: public
I want to change the background of my App's Activity. Now that is available
HI i change the app state and then i want to reload the activity
I want to change the app.setting connection string at the run time. I have
I want to change the app typeface and I can't: AndroidManifest.xml ... <application android:icon=@drawable/ic_launcher
I want to change my UI according to OS version my app is running
I want to change the background screens of one of my Blackberry app and

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.