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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:53:56+00:00 2026-05-18T23:53:56+00:00

My app crashes every time I start it in the emulator. Here is the

  • 0

My app crashes every time I start it in the emulator. Here is the logcat:

01-02 17:20:58.859: ERROR/AndroidRuntime(249): Uncaught handler: thread main exiting due to uncaught exception

01-02 17:20:58.889: ERROR/AndroidRuntime(249): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shoppinglist/com.shoppinglist.ShoppingList}: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at android.os.Handler.dispatchMessage(Handler.java:99)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at android.os.Looper.loop(Looper.java:123)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at android.app.ActivityThread.main(ActivityThread.java:4203)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at java.lang.reflect.Method.invokeNative(Native Method)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at java.lang.reflect.Method.invoke(Method.java:521)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)

01-02 17:20:58.889: ERROR/AndroidRuntime(249):     at dalvik.system.NativeStart.main(Native Method)**

Here is my .java file:

package com.shoppinglist;

import android.app.ListActivity;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class ShoppingList extends ListActivity {
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Button button1main = (Button) findViewById(R.id.Button01main);
     button1main.setOnClickListener(new OnClickListener()  {
     @Override
      public void onClick(View v)  {
       final Dialog dialog = new Dialog(ShoppingList.this);
       dialog.setContentView(R.layout.maindialog);
       dialog.setCancelable(true);
       Button button = (Button) dialog.findViewById(R.id.cancel);
       button.setOnClickListener(new OnClickListener()  {
        @Override
         public void onClick(View v)  {
          dialog.dismiss();
        }
        });
       dialog.show();
       }
     });
    }
}

My layout.xml:

<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#FFCC00"
    android:padding="10dp"
    android:id="@+id/listview">
        <Button
            android:id="@+id/Button01main"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
   android:text="Add item..."/>
</ListView> 

My dialog xml:

<?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:id="@+id/layout_root"
  android:orientation="vertical"
  android:background="#FFFFFF"
  android:minHeight="100dp"
  android:minWidth="300dp">
  <EditText
    android:id="@+id/edittext"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     android:hint="Type the name of an item here...">
   </EditText>
 <LinearLayout
  android:id="@+id/button_layout"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="horizontal"
  android:layout_gravity="right">
  <Button
   android:id="@+id/ok"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="OK"
   android:layout_gravity="bottom">
   </Button>
  <Button
   android:id="@+id/cancel"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content"
   android:text="Cancel"
   android:layout_gravity="bottom">
   </Button>
  </LinearLayout> 
</LinearLayout>

Any help will be appreciated. I need code samples for fixes, I am not very experienced.

  • 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-18T23:53:57+00:00Added an answer on May 18, 2026 at 11:53 pm

    In your layout xml, you’re trying to add a button inside a ListView. The ListView is an AdapterView , as the error says, so it must be populated by an adapter which provides a list of similar ‘things’ – these could be a list of strings (from an array list) or a list of custom views which you create, but they are all basically the same type of thing – you cant, for instance, add a button, then to another one add a string. Create an adapter to provide the things you want in your ListView.

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

Sidebar

Related Questions

I am new to programming and my app crashes every time I try to
My app crashes several times without any error or stack trace on my console.
my app crashes with this code.. it doesnt even start up.. any ideas guys
Every time I load the app it stops as if I had set a
I am learning GTK+ and this simple application crashes every time I run it.
Instruments.app crashes when I try to profile on the device. It works fine in
my app crashes often in this for-loop: for (int a = 0; a <=
my app crashes when the user tries to delete a row from the UITableView
my iphone app crashes unexpectedly and looking at the crash log I can't tell
When my app crashes, I get a crash report that takes 5 minutes to

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.