I think I found what u were talking about.
myCalcButton.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
double billNum = Double.parseDouble(myBillAmt.getText
().toString());
double preNum = Double.parseDouble
(myPrecentage.getText().toString());
myAns.setText(""+calcTip(billNum,preNum));
}
}
);
I dont relly understand what is going on here though. Could you please
explain this to me?
On Jan 17, 9:35 pm, "Eddie O'Hagan" <[email protected]> wrote:
> ok thanks ill give that a shot
>
> On Jan 17, 9:32 pm, Mark Murphy <[email protected]> wrote:
>
> > Eddie O'Hagan wrote:
> > > if(myCalcButton.isPressed())
> > > {
> > > double billNum = Double.parseDouble(myBillAmt.getText
> > > ().toString());
> > > double preNum = Double.parseDouble(myPrecentage.getText
> > > ().toString());
>
> > > myAns.setText(""+calcTip(billNum,preNum));
> > > }
>
> > > thats what i am useing right now and it still will not change the
> > > setText
>
> > You need to set an action listener on the button, to get control when
> > the button is pushed. Most examples in the ApiDemos with a Button will
> > demonstrate this technique, as will the online tutorials on the Android
> > site.
>
> > Then, in the listener callback, you can do the calculation you have
> > above, and it should update the TextView as you would expect.
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> > _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---