final Button button = (Button) findViewById(R.id.button_id);The other mechanism is to declare the listener method using the attribute:
button.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// onClick implementation
}
});
/**So, which do you prefer? Recommend? What is the compelling argument for either or both?
** onClick listener for ??? button
**
** @param view the view the that received the click
*/
public void methodName(final View view) {
// onClick implementation
}
--
You received this message because you are subscribed to the Google Groups "SoCal Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to socal-androi...@googlegroups.com.
To post to this group, send email to socal-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/561C8647.2070202%40JeffreyPeacock.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/etPan.561c8940.367a4a59.47c%40Wolfs-MacBook.techcasita.com.
--
You received this message because you are subscribed to the Google Groups "SoCal Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to socal-androi...@googlegroups.com.
To post to this group, send email to socal-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/561C8647.2070202%40JeffreyPeacock.com.
For more options, visit https://groups.google.com/d/optout.
-- Honesty is a very expensive gift. So, don't expect it from cheap people - Warren Buffett http://tayek.com/
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/561C8E81.80401%40JeffreyPeacock.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/etPan.561c9070.1bc8b71b.47c%40Wolfs-MacBook.techcasita.com.
final GuiAdapterABC adapterFor1=new GuiAdapterABC(tablet.model) {
@Override
public void setText(final int id,final String string) {
new Timer().schedule(new TimerTask() {
@Override
public void run() {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
((CheckBox)gui.idToButton.get(id)).setText(string);
}
});
}
},0);
}
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
((CheckBox)gui.idToButton.get(id)).setText(string);
}
});
/JTo view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/561C8F8C.4060202%40ca.rr.com.
Ray,
We need to talk about some of your code:
final GuiAdapterABC adapterFor1=new GuiAdapterABC(tablet.model) {
@Override
public void setText(final int id,final String string) {
new Timer().schedule(new TimerTask() {...
},0);
}
You're creating a Timer to schedule a Task to be run without delya to run something on the UI thread. Get rid of the overhead and just do:
activity.runOnUiThread(new Runnable() { @Override public void run() { ((CheckBox)gui.idToButton.get(id)).setText(string); } });/J
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/561D6428.5090600%40JeffreyPeacock.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/561D69BB.20402%40ca.rr.com.
I don't know how that can hapen unless the time/sapce continuum is completely out of wack.
The contract of activity.runOnUiThread() is to run the Runnable on the UI thread so the UI can be updated.
/J
To view this discussion on the web visit https://groups.google.com/d/msgid/socal-android/561D7457.40809%40JeffreyPeacock.com.
For more options, visit https://groups.google.com/d/optout.