Я пытаюсь изменить текст в текстовом представлении в расширении управления Sony SmartWatch одним нажатием кнопки. Однако метод TextView.setText()
не работает.
Вот мой расширенный класс ControlExtension
class SampleControlSmartWatch2 extends ControlExtension {
private static TextView textView = null;
SampleControlSmartWatch2(final String hostAppPackageName, final Context context,
Handler handler) {
//...
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.sample_control_2, null);
textView = (TextView) layout.findViewById(R.id.textToBeChanged);
}
//...
public void onObjectClick(ControlObjectClickEvent event) {
Log.i(TAG, "Before : " + textView.getText().toString()); // It shows "original"
textView.setText("changed");
Log.i(TAG, "After : " + textView.getText().toString()); // It shows "changed"
textView.invalidate(); // These two methods are added after read
textView.requestLayout(); // through several posts but it doesn't work
}
}
Зарегистрированный текст textView в LogCat отображается, как и ожидалось, но текст в эмуляторе не обновляется. Кто-нибудь знает, как это решить? Спасибо.