class clicker implements Button.OnClickListener
{
public void onClick(View v)
{
if(v==button1)
{
text1.setText(myChoice);
Toast.makeText(getBaseContext(),
"~~~~Successfully submitted~~~",
Toast.LENGTH_LONG).show();
}
if(v==button2)
{
/*Intent viewDataIntent = new Intent(SurveyActivity.this, Survey2.class);
String myData = "You should see this";
viewDataIntent.putExtra("valueOne", myData);
startActivity(viewDataIntent);
*/
text2.setText(text1.getText());
Toast.makeText(getBaseContext(),
text1.getText(),
Toast.LENGTH_LONG).show();
}
}
}
上記のプログラムでは、2つのeditTextボックスtext1とtext2があります。テキスト1の内容をテキスト2にコピーしようとしています。私はtext2.setText(text1.getText());
をやってみましたが動作しません。何か案は?editTextの内容を一方から他方にコピーしようとしてエラーが発生しました。
を試してみてください –
ボタン2を押すと、プログラムが停止したというエラーが表示されます。おそらくこの行のためです。text2.setText(text1.getText()); –
ちょうどあなたが他の編集テキストの内容をコピーする方法を知る必要があります.... –