큰 숫자를 표시하는 textview가 있고 숫자의 수가 5보다 큰 경우이 점과 함께 textview에 4 자리 만 표시하도록하고 싶습니다 (3544 ...) 나는 시도하지만이 오류가있어 :android 기본 유형 long에 substring (int, int)을 호출 할 수 없습니다.
이EditText EditNumber;
long theNumber;
String str = EditNumber.getText().toString();
theNumber = Long.parseLong(str);
if(theNumber >5)
{
theNumber = theNumber.substring(0,4)+"..."; // the error in this line.
textView1.setText(Long.toString(theSide));
}
else
{
textView1.setText(Long.toString(theNumber));
}
왜 String을 길게 파싱하고 String으로 파싱하는지 알 수 없습니다. 그게 무슨 말이야? 당신이 사용할 수있는'substring' 메쏘드를 가진 객체 인 String으로 남겨 둡니다. – Micer