Cześć, proszę o pomoc. Mam następujący kod:
public void firstNumber(View view) {
TextView t = (TextView) findViewById(R.id.textView);
temp=t.toString();
l=temp.length();
if(l==1&&temp.charAt(0)==0)
{
t.setText("");
t.setText("1");
System.out.println(firstNumber);
System.out.println(temp.length());
}
else {
temp = t.getText();
s=temp.toString();
t.setText(s + "1");
System.out.println(firstNumber);
System.out.println(temp.length());
}
}
Ma on za zadanie zastąpić zero jedynką lub dodać do istniejącego stringa "1". Jednak nie działa. Co robie źle i co zmienić żeby działało?