setText nie ustawia tekstu na EditText
Mam problem, którego nigdy wcześniej nie doświadczyłem od prawie trzech lat rozwijania z Androidem ...
Chcę zrobić zdjęcie i po zrobieniu zdjęciaEditText
s aktywności stają się jasne. To, co robię, to ustawianie wartościEditText
doStrings
za pomocągetText().toString()
przywrócić je po zrobieniu zdjęcia.
Ciągi są doskonale przechowywane w danych, ale gdy używamsetText
, to nie działa ... Dziwna rzeczsetHint
Prace!
Jak to możliwe?
Oto kod, którego używam:
@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
idescription
są globalneEditTexts
itempSpotName
itempSpotDesc
są globalneStrings
.
Jak mogę ustawić tekst?