@Override public void handleMessage(final Message msg) { try { if (waypoint == null) { Log.d("No waypoint loaded to edit. id= " + waypointId); waypointId = -1; } else { geocode = waypoint.getGeocode(); prefix = waypoint.getPrefix(); lookup = waypoint.getLookup(); own = waypoint.isUserDefined(); if (initViews) { visitedCheckBox.setChecked(waypoint.isVisited()); if (waypoint.getCoords() != null) { buttonLat.setText( waypoint.getCoords().format(GeopointFormatter.Format.LAT_DECMINUTE)); buttonLon.setText( waypoint.getCoords().format(GeopointFormatter.Format.LON_DECMINUTE)); } waypointName.setText( Html.fromHtml(StringUtils.trimToEmpty(waypoint.getName())).toString()); Dialogs.moveCursorToEnd(waypointName); if (TextUtils.containsHtml(waypoint.getNote())) { note.setText( Html.fromHtml(StringUtils.trimToEmpty(waypoint.getNote())).toString()); } else { note.setText(StringUtils.trimToEmpty(waypoint.getNote())); } Dialogs.moveCursorToEnd(note); } new AsyncTask<Void, Void, Geocache>() { @Override protected Geocache doInBackground(final Void... params) { return DataStore.loadCache(geocode, LoadFlags.LOAD_CACHE_ONLY); } @Override protected void onPostExecute(final Geocache cache) { setCoordsModificationVisibility(ConnectorFactory.getConnector(geocode), cache); } }.execute(); } if (own) { initializeWaypointTypeSelector(); } } catch (final RuntimeException e) { Log.e("EditWaypointActivity.loadWaypointHandler", e); } finally { if (waitDialog != null) { waitDialog.dismiss(); waitDialog = null; } } }
private void setLogText() { logEditText.setText(text); Dialogs.moveCursorToEnd(logEditText); }