Note that there are some explanatory texts on larger screens.

plurals
  1. POGeocoder failure - sometimes returning null array
    primarykey
    data
    text
    <p>I'm facing a problem, that I don't know how to solve. I have an app, that uses built-in android geocoder. The code is simple - I'm getting the address and coordinates to display them on the map. On the emulator, it runs just fine, but on all the real devices the app crashes, trying to get some addresses(geocoder returns null array). Here is the code: </p> <pre><code> @Override protected List&lt;Address&gt; doInBackground(String... params) { Log.d(TAG, "doinbackground SetRightMapDisplayAddress started"); long startTime= System.currentTimeMillis(); long threadId = Thread.currentThread().getId(); Log.d(TAG, String.format("The thread id is: %d", threadId)); context = getActivity(); String placeName = params[0]; List&lt;Address&gt; addressList = downloadData.findAddressesByName(context, placeName); int returnedAddresses = addressList.size(); Log.d(TAG, String.valueOf(returnedAddresses)); long endTime = System.currentTimeMillis(); Log.d(TAG, String.valueOf(startTime-endTime)); Log.d(TAG, "doinbackground SetRightMapDisplayAddress ended"); return addressList; } </code></pre> <p>The exception (it points to this line : </p> <pre><code>int returnedAddresses = addressList.size(); </code></pre> <p>):</p> <pre><code>07-01 15:41:58.509: ERROR/AndroidRuntime(9158): FATAL EXCEPTION: AsyncTask #3 java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:278) at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) at java.util.concurrent.FutureTask.setException(FutureTask.java:124) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) at java.util.concurrent.FutureTask.run(FutureTask.java:137) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) at java.lang.Thread.run(Thread.java:856) Caused by: java.lang.NullPointerException at com.shop.pagerFragments.TorgCentrMapFragment$SetRightMapDisplayAddress.doInBackground(TorgCentrMapFragment.java:349) at com.shop.pagerFragments.TorgCentrMapFragment$SetRightMapDisplayAddress.doInBackground(TorgCentrMapFragment.java:337) at android.os.AsyncTask$2.call(AsyncTask.java:264) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) ... 4 more </code></pre> <p>I've read a lot here, but I wasn't able to find the solution. Maybe there is a web api, that can grab the same address list?? Maybe there are some services, that are hidden and not available on the device (maybe I need to populate the alert and let the user turn on some services) ?? P.S. The location services were running on all the devices. Please, I need your help badly, guys.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
    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