- resultTextView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.cross, 0, 0);
+ updateResultTextView(responseMessage, true);
+ }
+
+ @Override
+ public void onError(final String error) {
+ updateResultTextView(error, true);
+ }
+
+ /**
+ * Update the {@link #resultTextView}.
+ *
+ * @param message new text for the TextView
+ * @param error true if the text is an error message, false otherwise
+ */
+ private void updateResultTextView(final String message, final boolean error){
+ handler.post(new Runnable() {
+ @Override
+ public void run() {
+ resultTextView.setText(message);
+ if(error)
+ resultTextView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.cross, 0, 0);
+ else
+ resultTextView.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.tick, 0, 0);
+ }
+ });