我遇到了一个在使用 Android 开发近三年来从未遇到过的问题......
我想拍照,拍照后,EditText
活动的s变得清晰。我正在做的是将 的值设置为用于EditText
在拍照后恢复它们。Strings
getText().toString()
字符串与数据完美存储,但是当我使用时setText
,它不起作用......奇怪的是它setHint
起作用了!
怎么会这样?
这是我正在使用的代码:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
// Image captured and saved to fileUri specified in the Intent
grabImage(imgView);
for (int u = 0; u <= 2; u++)
{
if (savedImgs[u].equals(""))
{
imgs = u + 1;
savedImgs[u] = photo.toString();
break;
}
}
/*Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); ---> It is a small bitmap, for icons...
imgView.setImageBitmap(thumbnail);
imgView.setVisibility(View.VISIBLE);*/
} else if (resultCode == RESULT_CANCELED) {
// User cancelled the image capture
} else {
Toast.makeText(this, "Image couldn't be taken. Try again later.", Toast.LENGTH_LONG).show();
}
}
if (!tempSpotName.equals("") || !tempSpotDesc.equals("")) {
name.setText(tempSpotName);
description.setText(tempSpotDesc);
}
}
name
和description
是全球性的 和EditTexts
是全球性的。tempSpotName
tempSpotDesc
Strings
如何设置文本?