Note that there are some explanatory texts on larger screens.

plurals
  1. POUI is updated when my app lost focus and regains focus. Strange issue
    primarykey
    data
    text
    <p>I want to update my textView in aynctask, but it is not updating at all. I am unable to find out my error.</p> <p>Here is my code :</p> <p><strong>NOTE : - UI is updated when my app lost focus and regains focus. Strange problem</strong> </p> <pre><code>public class LocateGeopoint extends AsyncTask&lt;LatLng, String, List&lt;Address&gt;&gt; { Geocoder geocoder; private TextView tv; public LocateGeopoint(View v) { this.geocoder = new Geocoder(v.getContext()); this.tv = (TextView) v.findViewById(R.id.textView1); } @Override protected void onPostExecute(List&lt;Address&gt; addresses) { super.onPostExecute(addresses); if(addresses!=null){ String city = addresses.get(0).getAddressLine(0); String country = addresses.get(0).getAddressLine(1); System.out.println(city+" "+country); tv.setText(city); } } @Override protected List&lt;Address&gt; doInBackground(LatLng... params) { // TODO Auto-generated method stub double lattitude = params[0].latitude; double longitude = params[0].longitude; List&lt;Address&gt; addresses = null; if (lattitude != 0 || longitude != 0) { try { addresses = geocoder.getFromLocation(lattitude, longitude, 1); } catch (IOException e) { e.printStackTrace(); } } return addresses; } } </code></pre> <p>XML file (Inflated one )</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/parent_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /&gt; &lt;FrameLayout android:id="@+id/view_container" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" android:text="Loading Address.." /&gt; &lt;/FrameLayout&gt; </code></pre> <p>Here is how I am calling the Asyntask from main activity</p> <pre><code>googleMap.setInfoWindowAdapter(new InfoWindowAdapter() { @Override public View getInfoWindow(Marker arg0) { return null; } @SuppressWarnings("unchecked") @Override public View getInfoContents(Marker marker) { LayoutInflater inflater = (LayoutInflater) MapsDemo.this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflater.inflate(R.layout.custom_info, null); new LocateGeopoint(v).execute(marker.getPosition()); return v; } }); </code></pre> <p>When I debug the application, then it is updated but normally it is not.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload