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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:06:12+00:00 2026-06-15T03:06:12+00:00

I have an Android program using the IntelliJ 12 Community Edition IDE. I need

  • 0

I have an Android program using the IntelliJ 12 Community Edition IDE. I need to navigate between the different layouts (.xml) I made with the use of buttons. But, whenever I run it using the emulator, it only opens the main.xml screen, whenever I click the buttons, it says that: “Unfortunately, ITax has stopped working.”

This is my code for the MyActivity.java class:

package com.example.ITax;

import android.app.Activity;
import android.content.Intent;
android.os.Bundle;
android.view.View;
import android.widget.Button;



public class MyActivity extends Activity {


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

    Button button1 = (Button)findViewById(R.id.btn_info);
    Button button2 = (Button)findViewById(R.id.btn_tutorial);
    Button button3 = (Button)findViewById(R.id.btn_calc);
    Button button4 = (Button)findViewById(R.id.btn_back_from_calcu);
    Button button5 = (Button)findViewById(R.id.btn_next_from_calcu);
    Button button6 = (Button)findViewById(R.id.btn_back_from_monthlyorannual);
    Button button7 = (Button)findViewById(R.id.btn_next_from_monthlyorannual);
    Button button8 = (Button)findViewById(R.id.btn_back_from_civilstatus);
    Button button9 = (Button)findViewById(R.id.btn_next_from_civilstatus);
    Button button10 = (Button)findViewById(R.id.btn_back_from_inputamount_monthly);
    Button button11 = (Button)findViewById(R.id.btn_compute_from_monthly);
    Button button12 = (Button)findViewById(R.id.btn_back_from_outputamount_monthly);
    Button button13 = (Button)findViewById(R.id.btn_home_from_outputamount_monthly);

}

public void Open_BasicInfo()
{
    Intent i = new Intent(this, OpenBasicInfo.class);

    startActivity(i);
}

public void Open_Tutorial()
{
    Intent i = new Intent(this, OpenTutorial.class);
    startActivity(i);
}

public void Open_Calculator()
{
    Intent i = new Intent(this, OpenCalculator.class);
    startActivity(i);
}

public void Open_MonthlyOrAnnually()
{
    Intent i = new Intent(this, OpenMonthlyOrAnnually.class);
    startActivity(i);
}

public void Open_CivilStatus()
{
    Intent i = new Intent(this, OpenCivilStatus.class);
    startActivity(i);
}

public void Open_InputAmountsFromMonthly()
{
    Intent i = new Intent(this, OpenInputAmountsFromMonthly.class);
    startActivity(i);
}

public void Open_OutputAmountsFromMonthly()
{
    Intent i = new Intent(this, OutputAmountsFromMonthly.class);
    startActivity(i);
}

public void Open_Main()
{
    Intent i = new Intent(this, MyActivity.class);
    startActivity(i);
}

}

I already created a class for each layout and declared in the Android manifest like this:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.ITax"
      android:versionCode="1"
      android:versionName="ITax 1.0">
<uses-sdk android:minSdkVersion="1"/>
<application android:label="@string/app_name" android:icon="@drawable/ic_launcher">

    <activity android:name=".MyActivity"
              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=".OpenCalculator">

    </activity>

    <activity android:name=".OpenCivilStatus">

    </activity>

    <activity android:name=".OpenInputAmountsFromMonthly">

    </activity>

    <activity android:name=".OutputAmountsFromMonthly">

    </activity>

    <activity android:name=".OpenTutorial">

    </activity>

    <activity android:name=".OpenBasicInfo">

    </activity>

    <activity android:name=".OpenMonthlyOrAnnually">

    </activity>

    <activity android:name=".OpenMain">

    </activity>

    </application>
</manifest>

I already put the code android:onClick = “name of method” in all of the buttons.

Help! what seems to be the wrong I did here? 🙁

My application in the emulator stops working whenever I already clicked the buttons. >.<

  • 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-15T03:06:13+00:00Added an answer on June 15, 2026 at 3:06 am

    In order to comply with the xml android:onclick=”MethodName”. Your activity must implement method that looks like this…

    public void MethodName(View v){}
    

    All of your onclick events are missing passing the View parameter.

    Personally I don’t like using the xml, because if you make a spelling mistake in your code. Your activity will crash because it can’t inflate the xml. This imo leaves you vulnerable to silly mistakes. Here a link in more details about all the ways to do a button onclick event In the end it’s up to you.

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

Sidebar

Related Questions

I have done one program in android using xml parsing but there is an
I have this problem when trying to run hello world program using android SDK.
I have an android program where I have multiple buttons using the same OnClickListener,
I have been using Traceview to improve some of my Android program. The problem
I have a program using android and I would like a few tips on
I have implemented an android program that can receive simple messages using the MJSIP,
i have wrote a program in android for webservice using soap. but iam not
I have built OpenSSL for Android(using ndk-build) and have linked it to my program.
i have recently developed a list program in android in which there is an
Hello i'm a new coder to android. I have a program that Plays Pauses

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.