What does the layout xml look like for these buttons? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware
On Fri, Oct 12, 2012 at 12:20 PM, Justin Anderson <[email protected]>wrote: > Have you looked at the logcat output for any signs of errors or anything? > I don't see anything obviously wrong with your code... > > You could try an anonymous class... Maybe something like this: > > ButtonMinus.setOnClickListener(new View.OnClickListener() { > > @Override > public void onClick(View v) { > Toast.makeText(this, "GoodBye World", Toast.LENGTH_LONG).show(); > } > }); > > Thanks, > Justin Anderson > MagouyaWare Developer > http://sites.google.com/site/magouyaware > > > > On Sat, Oct 6, 2012 at 8:27 AM, Dragon <[email protected]> wrote: > >> I have been trying for about 3-4 days trying to get my buttons to work >> and I feel like an idiot because I can't seem to solve my problem. The >> code I'm showing here is from the second page of my app. I am trying to >> get the buttons to work by showing a Toast so that I can further develop it >> by turning it into a counter. First things first, getting it to work with >> the toast so that I know it works. I appreciate the help. >> >> Here is the 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 >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Android Developers" group. >> To post to this group, send email to [email protected] >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/android-developers?hl=en > > > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

