How do i manage to print the "1110010100101011" sequence on the screen
i simple dont know, how here is the code:
public class BinarioParaDecimal extends Activity {
private EditText Input;
private EditText Solution;
private Button operator;
private Button btnReset;
private BinarioParaDecimal mContext;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mContext = this;
setContentView(R.layout.main);
Input = (EditText) findViewById(R.id.input);
Solution = (EditText) findViewById(R.id.solution);
operator = (Button) findViewById(R.id.ConverteBin);
btnReset = (Button)findViewById(R.id.btnReset);
// We create an OnClick Event in each button.
Button btnConverteBin = (Button)
findViewById(R.id.ConverteBin);
Button btnReset = (Button)
findViewById(R.id.btnReset);
btnReset.setOnClickListener(new
Button.OnClickListener() {
public void onClick (View v){
reset();
}});
btnConverteBin.setOnClickListener(new
OnClickListener() {
private AlertDialog show;
public void onClick(View arg0) {
if ((Input.getText().length() == 0)
||
(Input.getText().toString() == " ")
||
(Input.getText().length() == 0)
||
(Input.getText().toString() == " ")) {
setShow(new
AlertDialog.Builder(mContext).setTitle("Error")
.setMessage("Some
inputs are empty")
.setPositiveButton("OK",
null).show());
} else if
(operator.getText().equals("")) {
setShow(new
AlertDialog.Builder(mContext).setTitle("Error")
.setMessage("Operator
is null").setPositiveButton(
"OK", null).show());
} else if
(operator.getText().equals("Converte Para Binario")) {
double[] array = new
double[100];
Double result = new
Double(Input.getText().toString());
int i = 0;
while(result != 0){
result = result * 2;
result /= 2;
//HERE IS THE PROBLEM HOW DO
I PRINT THE ENTIRE NUMBER ON THE SCREEN?
}
Solution.setText(Double.toString(result));
}
}
public void setShow(AlertDialog
show) {
this.show = show;
}
public AlertDialog getShow() {
return show;
}
});
}
public void reset(){
Input.setText("");
Solution.setText("");
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.
NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en