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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:11:46+00:00 2026-05-20T14:11:46+00:00

I have a main activity, that holds the main menu. This menu has an

  • 0

I have a main activity, that holds the main menu. This menu has an option to start a second activity, which is a SurfaceView descendent.

I’m getting this error several times, but not always. I need to perform the process of calling the second activity via the first activity’s menu button, and then returning to the first activity. Eventually (Usually on the 7th repetition), the error happens when the 2nd. activity is being launched. Whitout the debugger, the phone screen becomes black and is blocked for about 30 or more seconds, then I see the dialog to close it. In debugger, the app stops on this exception.

My layout file for the second activity is:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <com.myapp.MySecActivity
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" android:id="@+id/sec_view"/>

</FrameLayout>

I have a Class MySecActivity, with loads this layout on constructor.

I figured out that I’m getting an InflateException on setContentView. I’m checking the id I pass to setContentView and it’s the same, not null, on all conditions:

int id = getResources().getIdentifier("mylayout", "layout", getPackageName());

if (id<= 0) {
    id= 0;  // just for debugging
} else {
   try {
       setContentView(id);
    } catch (InflateException e) {
       error = true;
    }
}
  • 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-20T14:11:47+00:00Added an answer on May 20, 2026 at 2:11 pm

    You need to have the <?xml .. ?> prelude as well as set your xml namespace. Are you doing this?

    <?xml version="1.0" encoding="utf-8"?>
    <com.myapp.MySecActivity
        xmlns:android="http://schemas.android.com/apk/res/android"
        ...
    

    If com.myapp.MySecActivity is not your root element, then try pasting your entire layout if you’d us to look at it.

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

Sidebar

Related Questions

I have work that needs to be done in this order: In main activity:
i have a main Activity called Main which has onActivityResult Method. protected void onActivityResult(int
My current application has one Activity, the main one which extends ListActivity (listview of
I have a main activity that launches a child activity using the following code:
I have a map view activity that shows a few OverlayItems . In the
Let's say I have 3 classes. Class A (extends Activity) Class B Class C
I have four tabs that hold four listviews, I want to set a background
I created a widget that works great until I restart the phone, then the
I'm working on making an iPhone version of an Android app that I've written
I'm having a problem with the AsyncTask class. It seems like my task stops

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.