기본적으로 원하는 것은 : 버튼을 클릭하면 "아니오"라고 대답 할 때 빈 텍스트보기가 "왜?"로 변경되기를 원합니다. 그런 다음 편집 텍스트 상자에 이유를 입력 할 수 있습니다. 마지막 클래스는 모든 문제를 나열 할 수 있습니다. 기계적 인조 인간.다른 클래스의 목록에 EditText를 어떻게 설정합니까?
package com.toc.maintenance;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class Safety extends Activity {
Button yes, No, NA, done;
TextView display;
@SuppressLint("SimpleDateFormat")
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.safety);
No = (Button) findViewById(R.id.bNo);
yes = (Button) findViewById(R.id.bYes);
display = (TextView) findViewById(R.id.textView2);
SimpleDateFormat dateFormat = new SimpleDateFormat(
"yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
String starttime = dateFormat.format(cal.getTime());
Intent i = new Intent(getApplicationContext(), Report.class);
i.putExtra("starttime", starttime);
yes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent Safety1 = new Intent(getApplicationContext(),
Safety1.class);
startActivity(Safety1);
}
});
NA = (Button) findViewById(R.id.bNA);
NA.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent Safety1 = new Intent(getApplicationContext(),
Safety1.class);
startActivity(Safety1);
}
});
No.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
display.setText("Why?");
}
});
done.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//here (at done button)is where I want to capture the editText for the final class
//"Report". I have an editBox with "@+id/explain" tag.
//But I am going to keep on adding text throughout the app.
//I've tried a setText, super, etc. But I just can't get it right. Thanks in advance.
}
});
}
} 당신이 다음 클래스에서 활동을 의미하는 경우
예 또는 아니요로 버튼을 사용하고 버튼을 눌렀을 때 .setText를 사용하여 종료되었습니다. 훨씬 쉬워졌습니다. – George