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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T16:49:21+00:00 2026-06-07T16:49:21+00:00

There is no error in my code but the application force closes at the

  • 0

There is no error in my code but the application force closes at the start itself. Following is the code.

package com.amit.wozzle;

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

import android.view.Menu;
import android.view.View;
import android.widget.Button;

public class MainActivity extends Activity {
/** Called when the activity is first created. */
private Button b1;
private Button b2;
private Button b3;
private Button b4;
private Button b5;
private Button b6;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    b1 = (Button) findViewById(R.id.g1);
    b2 = (Button) findViewById(R.id.g2);
    b3 = (Button) findViewById(R.id.g3);
    b4 = (Button) findViewById(R.id.g4);
    b5 = (Button) findViewById(R.id.g5);
    b6 = (Button) findViewById(R.id.g6);


    b1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent r1= new Intent("com.amit.wozzle.GAMEPLAY");
            r1.putExtra("choice", 1);
            startActivity(r1);
        }
    });


    b2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent r1= new Intent("com.amit.wozzle.GAMEPLAY");
            r1.putExtra("choice", 2);
            startActivity(r1);
        }
    });


    b3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent r1= new Intent("com.amit.wozzle.GAMEPLAY");
            r1.putExtra("choice", 3);
            startActivity(r1);
        }
    });


    b4.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent r1= new Intent("com.amit.wozzle.GAMEPLAY");
            r1.putExtra("choice", 4);
            startActivity(r1);
        }
    });


    b5.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent r1= new Intent("com.amit.wozzle.GAMEPLAY");
            r1.putExtra("choice", 5);
            startActivity(r1);
        }
    });


    b6.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent r1= new Intent("com.amit.wozzle.GAMEPLAY");
            r1.putExtra("choice", 6);
            startActivity(r1);
        }
    });




}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

}

This is logcat.

07-15 12:57:37.632: D/AndroidRuntime(666): Shutting down VM
07-15 12:57:37.632: W/dalvikvm(666): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-15 12:57:37.642: E/AndroidRuntime(666): FATAL EXCEPTION: main
07-15 12:57:37.642: E/AndroidRuntime(666): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.amit.wozzle/com.amit.wozzle.MainActivity}:    java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in    AdapterView
07-15 12:57:37.642: E/AndroidRuntime(666):  at   android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-15 12:57:37.642: E/AndroidRuntime(666):  at   android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.os.Handler.dispatchMessage(Handler.java:99)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.os.Looper.loop(Looper.java:123)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.app.ActivityThread.main(ActivityThread.java:4627)
07-15 12:57:37.642: E/AndroidRuntime(666):  at java.lang.reflect.Method.invokeNative(Native Method)
07-15 12:57:37.642: E/AndroidRuntime(666):  at java.lang.reflect.Method.invoke(Method.java:521)
07-15 12:57:37.642: E/AndroidRuntime(666):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-15 12:57:37.642: E/AndroidRuntime(666):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-15 12:57:37.642: E/AndroidRuntime(666):  at dalvik.system.NativeStart.main(Native Method)
07-15 12:57:37.642: E/AndroidRuntime(666): Caused by: java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.widget.AdapterView.addView(AdapterView.java:461)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:622)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
07-15 12:57:37.642: E/AndroidRuntime(666):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.app.Activity.setContentView(Activity.java:1647)
07-15 12:57:37.642: E/AndroidRuntime(666):  at com.amit.wozzle.MainActivity.onCreate(MainActivity.java:23)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-15 12:57:37.642: E/AndroidRuntime(666):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-15 12:57:37.642: E/AndroidRuntime(666):  ... 11 more

Could anybody please tell what error is there ?

  • 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-06-07T16:49:22+00:00Added an answer on June 7, 2026 at 4:49 pm

    I think there is an error in your code. On the 4th line it states that “addview is not supported in adapterview.” It looks like that is indicating you should wrap that in a try/catch block and catch that error so that it is not force closing your app or you need to figure out why that addView is not supported with the adapterview.
    Also, from that line that says “caused by” you can see the error repeated.

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

Sidebar

Related Questions

The following code is executing perfectly but there is a mySQL error somewhere that
I'm pretty sure there's some quick and easy error in this code but somehow
Is there an error with the following code? imagedashedline($image, $posax, $posay, $posbx, $posay, $black);
There's probably a silly error in my code. I have defined the following variables:
The following line of code generates the compile time error (PE19) There is no
With the following code below, There is an error saying File /home/user/web_pro/info/views.py, line 184,
Please, explain, why in the following code there is no error: void f() {
i use such code, but it renders with error <li class=dd0><div id=dt1<a href=http://localhost:1675/Category/29-books.aspx>Books</a></div></li> there
I test password recovery, but there are errors. Rspec study recently. code (User Controller)
Is there a good way to debug exited with code 5 runtime error on

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.