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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:01:56+00:00 2026-05-23T21:01:56+00:00

I’m very new to Android programming and am having a rough start. I’ve created

  • 0

I’m very new to Android programming and am having a rough start. I’ve created a general UI for a program and haven’t changed any of the actual Java code. Whenever I try to load the app in the emulator just to see what it looks like, the app crashes. Does anyone have an idea as to why this would happen?

Also, other apps that I made from tutorials work perfectly fine, just the one that I recently created a layout for doesn’t work.

Here is the Java code

package com.nubs.tableposv0_1;

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

public class TablePOSv0_1Activity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}

Here is the updated XML code

<?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="horizontal"
    android:weightSum="5"
    >
    <LinearLayout
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1"
        android:orientation="vertical"
        >
        <Button android:id="@+id/item1"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 1"
            />
        <Button android:id="@+id/item2"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 2"
            />
        <Button android:id="@+id/item3"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 3"
            />
        <Button android:id="@+id/item4"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 4"
            />
        <Button android:id="@+id/item5"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 5"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="1"
        android:orientation="vertical"
        >
        <Button android:id="@+id/item6"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 6"
            />
        <Button android:id="@+id/item7"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 7"
            />
        <Button android:id="@+id/item8"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 8"
            />
        <Button android:id="@+id/item9"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 9"
            />
        <Button android:id="@+id/item10"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="Item 10"
            />
    </LinearLayout>
    <LinearLayout
        android:layout_height="fill_parent"
        android:layout_width="fill_parent"
        android:layout_weight="3"
        android:orientation="vertical"
        android:weightSum="9"
        >
        <TableLayout
            android:id="@+id/items_table"
            android:layout_width="fill_parent"
            android:layout_weight="4"
            >
            </TableLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:orientation="horizontal"
            android:layout_weight="1"
            android:weightSum="3"
            >
            <Button android:id="@+id/calc1"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="1"
                />
            <Button android:id="@+id/calc2"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="2"
                />
            <Button android:id="@+id/calc3"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="3"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:layout_weight="1"
            android:weightSum="3"
            >
            <Button android:id="@+id/calc4"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="4"
                />
            <Button android:id="@+id/calc5"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="5"
                />
            <Button android:id="@+id/calc6"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="6"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:layout_weight="1"
            android:weightSum="3"
            >
            <Button android:id="@+id/calc7"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="7"
                />
            <Button android:id="@+id/calc8"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="8"
                />
            <Button android:id="@+id/calc9"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="9"
                />
        </LinearLayout>
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="horizontal"
            android:layout_weight="1"
            android:weightSum="3"
            >
            <Button android:id="@+id/calc0"
                android:layout_weight="2"
                android:layout_height="fill_parent"
                android:text="0"
                />
            <Button android:id="@+id/calcdec"
                android:layout_weight="1"
                android:layout_height="fill_parent"
                android:text="."
                />
        </LinearLayout>
        <Button android:id="@+id/total"
            android:layout_weight="1"
            android:layout_width="fill_parent"
            android:text="Total"
            />
    </LinearLayout>
</LinearLayout>

Logcat:

07-22 01:24:41.793: ERROR/AndroidRuntime(392):     at android.app.Activity.setContentView(Activity.java:1647)
07-22 01:24:41.793: ERROR/AndroidRuntime(392):     at com.nubs.tableposv0_1.TablePOSv0_1Activity.onCreate(TablePOSv0_1Activity.java:15)
07-22 01:24:41.793: ERROR/AndroidRuntime(392):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-22 01:24:41.793: ERROR/AndroidRuntime(392):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-22 01:24:41.793: ERROR/AndroidRuntime(392):     ... 11 more
07-22 01:25:41.482: ERROR/DefContainer(224): Couldn't copy file: /data/local/tmp/TablePOSv0_1.apk
  • 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-23T21:01:57+00:00Added an answer on May 23, 2026 at 9:01 pm

    If I recall correctly, LinearLayouts require both android:layout_width and android:layout_height dimensions.

    In your XML, there are several without android:layout_width.

    Also, next time post your Logcat output. They are much more useful than the code itself in those cases. That’s why I’m only guessing here a problem that happened to me once.

    // edit:

    If it’s still crashing, try to include both dimensions in all widgets. I don’t remember exactly if it’s just layouts of all widgets that require both dimensions. And puh-lease, give us the logcat. 🙂

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Specifically, suppose I start with the string string =hello \'i am \' me And
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites 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.