[android-beginners] Re: how to change text in a Button

2009-09-16 Thread Mark Murphy

cellurl wrote:
 Heres my code.
 I don't see a .setText for View.

Button is a subclass of View.

private void findViews
   // Set up click listeners for all the buttons
   View aboutButton25 = findViewById(R.id.about_button25);

Button aboutButton25=(Button)findViewById(R.id.about_button25);

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Development Wiki: http://wiki.andmob.org

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: how to change text in a Button

2009-09-15 Thread Jack Ha

Please refer to the Android Developer Guide.

button.setText()

--
Jack Ha
Open Source Development Center
・T・ ・ ・Mobile・ stick together
The coverage you need at the price you want

The views, opinions and statements in this email are those of
the author solely in their individual capacity, and do not
necessarily represent those of T-Mobile USA, Inc.


On Sep 15, 9:34 am, cellurl gpscru...@gmail.com wrote:
 Hi,

 On the fly, I want to change the text shown in a Button.

 Q: How do I do that.

 My teacher held me back a year from Android school ;-)
 (newbie again)
 jim
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: how to change text in a Button

2009-09-15 Thread cellurl

Heres my code.
I don't see a .setText for View.
I guess I am confusing button and view.
thanks for any help.
jp


AndroidManifest.xml--

activity android:name=.About25
android:label=@string/about_title
android:theme=@android:style/Theme.Dialog
/activity


---Translate.java


   private void findViews
  // Set up click listeners for all the buttons
  View aboutButton25 = findViewById(R.id.about_button25);
  aboutButton25.setOnClickListener(this);

  broke here ??
  if(mph) {
 aboutButton25.setText(25 Mph);
  } else {
 aboutButton25.setText(25 Kph);
  }

   }


   public void onClick(View v) {

  switch (v.getId()) {

  case R.id.about_button25:
 Intent i25 = new Intent(this, About25.class);
 startActivity(i25);
 break;
   }


--About25.java---


public class About25 extends Activity {

}




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: how to change text in a Button

2009-09-15 Thread Justin Anderson
Don't make it a View... Make it a Button.  Button inherits from TextView.
http://developer.android.com/reference/android/widget/Button.html

Thanks,
Justin

--
There are only 10 types of people in the world...
Those who know binary and those who don't.
--


On Tue, Sep 15, 2009 at 8:01 PM, cellurl gpscru...@gmail.com wrote:


 Heres my code.
 I don't see a .setText for View.
 I guess I am confusing button and view.
 thanks for any help.
 jp


 AndroidManifest.xml--

activity android:name=.About25
android:label=@string/about_title
android:theme=@android:style/Theme.Dialog
/activity


 ---Translate.java


   private void findViews
  // Set up click listeners for all the buttons
  View aboutButton25 = findViewById(R.id.about_button25);
  aboutButton25.setOnClickListener(this);

  broke here ??
  if(mph) {
 aboutButton25.setText(25 Mph);
  } else {
 aboutButton25.setText(25 Kph);
  }

   }


   public void onClick(View v) {

  switch (v.getId()) {

  case R.id.about_button25:
 Intent i25 = new Intent(this, About25.class);
 startActivity(i25);
 break;
   }


 --About25.java---


 public class About25 extends Activity {

 }




 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---



[android-beginners] Re: how to change text in a Button

2009-09-15 Thread cellurl

thanks

On Sep 15, 11:12 pm, Justin Anderson janderson@gmail.com wrote:
 Don't make it a View... Make it a Button.  Button inherits from 
 TextView.http://developer.android.com/reference/android/widget/Button.html

 Thanks,
 Justin

 --
 There are only 10 types of people in the world...
 Those who know binary and those who don't.
 --

 On Tue, Sep 15, 2009 at 8:01 PM, cellurl gpscru...@gmail.com wrote:

  Heres my code.
  I don't see a .setText for View.
  I guess I am confusing button and view.
  thanks for any help.
  jp

  AndroidManifest.xml--

         activity android:name=.About25
                 android:label=@string/about_title
                 android:theme=@android:style/Theme.Dialog
         /activity

  ---Translate.java

    private void findViews
       // Set up click listeners for all the buttons
       View aboutButton25 = findViewById(R.id.about_button25);
       aboutButton25.setOnClickListener(this);

       broke here ??
       if(mph) {
          aboutButton25.setText(25 Mph);
       } else {
          aboutButton25.setText(25 Kph);
       }

    }

    public void onClick(View v) {

       switch (v.getId()) {

       case R.id.about_button25:
          Intent i25 = new Intent(this, About25.class);
          startActivity(i25);
          break;
    }

  --About25.java---

  public class About25 extends Activity {

  }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Android Beginners group.
To post to this group, send email to android-beginners@googlegroups.com
To unsubscribe from this group, send email to
android-beginners-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en
-~--~~~~--~~--~--~---