onを作成setOnFocusChangeListener
したEditText
ので、文字列を取得してTextView
viaに追加しsetText()
ます。ただし、別EditText
の.toString()
setOnFocusListener
私のコードは次のとおりです。おそらく、混乱の少ない方法で説明します。
final TextView team1NameScore = (TextView) findViewById(R.id.team1NameScore);
final EditText team1Name = (EditText) findViewById(R.id.team1Name);
team1Name.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
String team1NameString = team1Name.getText().toString();
// Right here I need to make the above line public so I can use it later!
if (!hasFocus) {
team1NameScore.setText(team1NameString + "'s Score:");
}
}
});
(5行目のコメントを読んでください)
私は多くのフォーカス リスナーを持っています...最後にユーザー用に生成する 1 つのプレビューにそれらを結合したいと思います (`setText(textview1 + textview2 + team1Name) を使用)