Hi all, This is my code but i can't fill my string with the value puuted in by the user.
I've tried a lot of solutions from other sites but it won't work.
Somebody please help me! Thanks already
package app.android.Mel
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
public class RedFlashlightActivity extends Activity {
private EditText text;
private TextView myRecord;
private Button myButton;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
text = (EditText) findViewById(R.id.txtName);
myButton = (Button) this.findViewById(R.id.myButton);
myRecord = (TextView) findViewById(R.id.myRecord);
final String rec = text.getText().toString();
myButton.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
myRecord.setText(rec);
Toast.makeText(RedFlashlightActivity.this,rec, Toast.LENGTH_SHORT).show();
}
});
}
}