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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:19:31+00:00 2026-05-19T22:19:31+00:00

my initial screen is basically from a listactivity which displays a list of records.

  • 0

my initial screen is basically from a listactivity which displays a list of records. i created a menu that should open a new window for entry but always force closes when i click it. below are my codes:

Guestbook.java (ListActivity)
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
        case R.id.mnuNew:
            //setContentView(R.layout.form);
            Intent mIntent  = new Intent(getApplicationContext(), Maintenance.class);
            startActivityForResult(mIntent, 0);

            //Toast.makeText(getApplicationContext(), "Test", Toast.LENGTH_SHORT).show();
            return true;
        default:
            return super.onOptionsItemSelected(item);
        }
    }

here is the code for Maintenance.class

package com.android.guestbook;

import android.app.Activity;
import android.os.Bundle;

public class Maintenance extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.form);
    }
}

is there something wrong with my code?

here is the logcat info.

02-06 07:02:29.617: INFO/ActivityManager(59): Starting activity: Intent { cmp=com.android.guestbook/.Maintenance }
02-06 07:02:29.956: DEBUG/AndroidRuntime(276): Shutting down VM
02-06 07:02:29.956: WARN/dalvikvm(276): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
02-06 07:02:30.107: ERROR/AndroidRuntime(276): FATAL EXCEPTION: main
02-06 07:02:30.107: ERROR/AndroidRuntime(276): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.guestbook/com.android.guestbook.Maintenance}: java.lang.RuntimeException: Binary XML file line #82: You must supply a layout_width attribute.
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.os.Handler.dispatchMessage(Handler.java:99)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.os.Looper.loop(Looper.java:123)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.main(ActivityThread.java:4627)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invokeNative(Native Method)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invoke(Method.java:521)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at dalvik.system.NativeStart.main(Native Method)
02-06 07:02:30.107: ERROR/AndroidRuntime(276): Caused by: java.lang.RuntimeException: Binary XML file line #82: You must supply a layout_width attribute.
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:491)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:3592)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:3672)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.widget.LinearLayout$LayoutParams.<init>(LinearLayout.java:1395)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:1321)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.widget.LinearLayout.generateLayoutParams(LinearLayout.java:45)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.Activity.setContentView(Activity.java:1647)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at com.android.guestbook.Maintenance.onCreate(Maintenance.java:11)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
02-06 07:02:30.107: ERROR/AndroidRuntime(276):     ... 11 more
02-06 07:02:30.216: WARN/ActivityManager(59):   Force finishing activity com.android.guestbook/.Maintenance
02-06 07:02:30.267: WARN/ActivityManager(59):   Force finishing activity com.android.guestbook/.GuestBook

here is my form.xml for the Maintenance class.

> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout  
> xmlns:android="http://schemas.android.com/apk/res/android"
> android:layout_width="fill_parent"  
> android:layout_height="fill_parent"  
> android:orientation="vertical">
>     <LinearLayout         
>       android:layout_height="wrap_content"
>       android:layout_width="fill_parent">
>         <TextView 
>           android:layout_width="fill_parent" 
>           android:layout_height="wrap_content" 
>           android:text="@string/name" />
>     </LinearLayout>
>     <LinearLayout 
>       android:layout_height="wrap_content" 
>       android:layout_width="fill_parent">
>         <EditText 
>           android:inputType="textPersonName"
>           android:layout_width="fill_parent" 
>           android:layout_height="wrap_content" 
>           android:id="@+id/name" 
>           android:hint="Enter your name here" />
>     </LinearLayout>
>     <LinearLayout 
>       android:layout_height="wrap_content"
>       android:layout_width="fill_parent">
>         <TextView 
>           android:layout_width="wrap_content" 
>           android:layout_height="wrap_content" 
>           android:text="@string/email" />
>     </LinearLayout>
>     <LinearLayout 
>       android:layout_height="wrap_content" 
>       android:layout_width="fill_parent">
>         <EditText 
>           android:inputType="textEmailAddress"
>           android:layout_width="fill_parent" 
>           android:layout_height="wrap_content" 
>           android:id="@+id/email" 
>           android:hint="Enter your email here" />
>     </LinearLayout>
>     <LinearLayout 
>       android:layout_height="wrap_content" 
>       android:layout_width="fill_parent">
>         <TextView 
>           android:layout_width="wrap_content" 
>           android:layout_height="wrap_content" 
>           android:text="@string/message" />
>     </LinearLayout>
>     <LinearLayout 
>       android:layout_height="wrap_content" 
>       android:layout_width="fill_parent">
>         <EditText 
>           android:inputType="textMultiLine"
>           android:layout_width="fill_parent" 
>           android:layout_height="wrap_content" 
>           android:id="@+id/message" 
>           android:hint="Enter your message here"></EditText>
>     </LinearLayout>
>     <LinearLayout 
>       android:layout_height="wrap_content" 
>       android:layout_width="fill_parent">
>         <Button 
>           android:onClick="onClick"
>           android:layout_weight="1"
>           android:layout_width="fill_parent" 
>           android:layout_height="wrap_content" 
>           android:id="@+id/submit" 
>           android:text="@string/submit" />
>         <Button 
>           android:onClick="onClick"
>           android:layout_weight="1"
>           android:layout_width="fill_parent" 
>           android:layout_height="wrap_content" 
>           android:id="@+id/cancel" 
>           android:text="@string/cancel" />
>     </LinearLayout>
>     <ListView
>       android:id="@+id/list" /> </LinearLayout>
  • 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-19T22:19:32+00:00Added an answer on May 19, 2026 at 10:19 pm

    Did you declare your Maintenance.class – Activity in your Manifest file?!

    You need to put the <activity>-Tag in your AndroidManifest.xml between the <application>-Tag:

    <application android:label="@string/app_name" android:icon="@drawable/icon" android:debuggable="true">
        <activity android:name=".activities.Guestbook"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".activities.Maintenance "
            android:label="@string/app_name">
        </activity>
    
    </application>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The concept of a splash screen doesn't strike me as something that should be
i am able to launch any apps which are on emulator screen from my
It's a pygame question, and the list basically holds the positions that the user
I'm using a 100% screen size iframe that redirects to another domain. Basically you
Initial tests indicate that GDI+ (writing in VB.NET) is not fast enough for my
We're in the initial stages of a large project, and have decided that some
I am doing some initial testing for a Rails app which will be deployed
i am pretty new to the iOS world and since I'm coming from the
I had been fooling around with an initial splash screen but decided not to
I need this miss button to be GONE on the initial screen, then appear

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.