DragonRider71
Lurker
I have been trying for the last 3-4 days to get my buttons to work and I can't figure out what my problem is. I feel like it is so simple, yet I just don't see it.
Current task:
Getting the buttons to display a Toast message so that I can ensure the buttons are working.
Next task:
Create an increase and decrease counter......first things first though
I appreciate the help.
Current task:
Getting the buttons to display a Toast message so that I can ensure the buttons are working.
Next task:
Create an increase and decrease counter......first things first though
I appreciate the help.
Code:
package com.sports.discgolfou;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
public class hole_1 extends Activity implements View.OnClickListener{
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_page2);
//TextView SC = (TextView) findViewById(R.id.labelShotCounter);
Button ButtonAdd = (Button) findViewById(R.id.buttonAdd);
ButtonAdd.setOnClickListener(this);
Button ButtonMinus = (Button) findViewById(R.id.buttonMinus);
ButtonMinus.setOnClickListener(this);
}//End onCreate
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(v.getId() == R.id.buttonAdd)
{
Toast.makeText(this, "Hello World", Toast.LENGTH_LONG).show();
}
else if(v.getId() == R.id.buttonMinus)
{
Toast.makeText(this, "GoodBye World", Toast.LENGTH_LONG).show();
}
}//End onClick
}//End Activity