안녕하세요 저는 Android에서 계산기로 작업 중입니다. wchich에서 EditText를 사용하고 있지 않습니다. 특정 no.for의 클릭에 따라 표시됩니다. 예를 들어, 사용자가 1을 누르면, 1.now가 표시되고, 사용자가 2를 클릭하면 12가 표시됩니다.버튼을 클릭하면 Android에서 EditText에서 텍스트를 가져 오는 중
내가이
public class Main extends Activity implements OnClickListener {
public static int no1=0,no2=0,op=0,flag=0;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
EditText display1=(EditText) findViewById(R.id.display);
Button one= (Button) findViewById(R.id.one);
one.setOnClickListener(this);
}
public void onClick(View v) {
if(v.getId()==R.id.one)
{
switch(flag)
{
case 1:no1*=10+1;display1.setText(no1);
case 2:no2*=10+1;display1.setText(no2);
}
}
같은 것들을 가지고 있지만 여기에 내가 "디스플레이 1가 해결 될 수 없다"로 오류를 얻고있다.
작업을 만드는 모든 솔루션 .. ??
텍스트를 가져 오거나 텍스트를 설정하고 싶습니다. – Manmohan
@nikhil은 edittext를 전역 적으로 선언합니다. –