Sunday, 29 September 2013

My app will only output "false", not the code I want

My app will only output "false", not the code I want

I used samples from similar code to make this, unfortunately I'm not to
sure what I did wrong. 2.The purpose of this app is to output text entered
in a field to a TextView, where I changed the color, when a button is
pressed.
package edu.wmich.project3
import android.os.Bundle; import android.app.Activity; import
android.view.View; import android.widget.Button; import
android.widget.TextView; import android.view.View.OnClickListener;
public class Main extends Activity {
String txtResult;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button text =(Button) findViewById(R.id.btnColor0);
final TextView result = ((TextView) findViewById(R.id.txtResult));
text.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
txtResult= getText(R.id.txtField0).toString();
result.setText(txtResult);
}
});
} }

No comments:

Post a Comment