package org.dixit.com
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class ChangeTextValue extends Activity {
/** Called when the activity is first created. */
private int i = 1;
private TextView txt;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txt = (TextView)findViewById(R.id.TextView01);
Button btn = (Button)findViewById(R.id.Button01);
btn.setOnClickListener(new View.OnClickListener()
{
public void onClick(View view)
{
if(i%2==0)
{
txt.setText("hellooooo Dixit");
i++;
}
else
{
txt.setText("hellooooo Gabriel");
i++;
}
}
});
}
}
hey buddy.. use this logic its working on my system. for this u run
this code and i hope its working on your system.
On Mar 27, 9:25 pm, Gabriel <[email protected]> wrote:
> It's not working Dixie. Can you put this code more clear?
>
> On 27 mar, 13:09, Dixi <[email protected]> wrote:
>
>
>
>
>
>
>
> > use the even-odd logic.. like
>
> > int i=1;
> > button.onclick()
> > {
> > if(i%2==0)
> > {
> > ///operation...
> > i++;
> > }
>
> > else
> > {
> > //operation....
> > i++;
> > }
>
> > }
>
> > i think u got it...
> > i hope it works....
>
> > -
> > Regards
> > Dixit Wadhwani
>
> > On Mar 27, 8:55 pm, Gabriel <[email protected]> wrote:
>
> > > How I create a button with two functions?
> > > For example, when I click it once it starts a sound, and if I click it
> > > again it stops the sounds.
>
> > > Or a Mute button, that when I click it mutes all the sounds and change
> > > the imagebutton for a "mute off" image and if I click it again the
> > > sound returns.
>
> > > I appreciate any help. Thanks
--
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