Back to project page dice-probabilities.
The source code is released under:
MIT License
If you think the Android project dice-probabilities listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.kleemann.diceprobabilities; /*from w ww . j a va2 s . c o m*/ import android.view.View; import android.widget.Button; /** * Provides the behavior for a button that, when pressed, adds to a paired button * that represents the current count of that number of dice. */ public class PoolDicePile implements View.OnClickListener { private CurrentDicePile current; public PoolDicePile(Button button, CurrentDicePile current) { this.current = current; button.setText(render()); button.setOnClickListener(this); } private String render() { return current.getSides()==1 ? "+1" : "+d"+current.getSides(); } public void onClick(View v) { current.increment(); } }