I have a very simple application with two buttons and a text. I press one and the number on the text goes up. The other makes the number decrease. Here is my code.

package com.bryantpc.itemcounter;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.bryantpc.itemcounter.R;

public class IC_MAIN extends ActionBarActivity {

 private int Amount1 = 0;

protected void onCreate(Bundle savedInstanceState) {

   final Button Button1 = (Button)findViewById(R.id.button1);       
   final Button Button2 = (Button)findViewById(R.id.button2);       

   final TextView TextView1 = (TextView)findViewById(R.id.textView1);      

   Button1.setOnClickListener(new OnClickListener() {
       public void onClick(View v) {      

   Button2.setOnClickListener(new OnClickListener() {
        public void onClick (View v) {

Every time when I press one of the buttons, the app stops working. Anyone knows what's going on? P.S I have no LogCat because my emulator is not working I am running the APK on my phone.

Related posts

Recent Viewed