Hey guys, I know that this is most likely the most n00bish question
asked in this group, but I'm pulling my hair out here. I am currently
enrolled in Software Engineering at University and have just finished
a module on Java programming , so Java isn't new to me. But for the
life of me, I just cannot impliment buttons into my app. What I need
to do is to have 3 buttons, each calling the same method but passing a
different parameter into the method. I have tried various methods
such as:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
// Capture our button from layout
Button button = (Button) findViewById(R.id.button1);
// Register the onClick listener with the implementation above
button.setOnClickListener(mCorkyListener);
}
private OnClickListener mCorkyListener = new OnClickListener() {
public void onClick(View v) {
if (v.getId() == R.id.button) {
random(0,100);
} else {
reset();
}
Log.d("DEBUGTAG", "onClick called");
}
};
And each time it force closes, the LogCat states that it is due to
"ImageButton".
If anyone could help, I would be very grateful.
Thank you in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---