This error happens when you try to parse a returned JSON string in Javascript. Chances are, the string that want to parse as a JSON object is already parsed, hence the error message “Unexpected token o”.

The solution is to use the variable returned to you, say from an asynchronous call as a JSON Object rather than trying to parse it again.

While this is not really an error, extra data that is not used should not be included in any output as it will only add to the extra bytes.

When you look at your JSON output, you realized the column names and values also have extra index column numbers and the associated values included.

To remove this, simply add an option in the PDO when you instantiate a database connection in PHP like this:

That should fix the problem. When you use json_encode(), there will be no more duplicate values with the corresponding column index number as key.

Well, here’s the thing. The execute() method of AsyncTask were first introduced to execute serially on a single background thread.

Then it was changed to a pool of threads allowing multiple tasks to operate in parallel beginning with Android Donut OS.

With HoneyComb, tasks are executed on a single thread to avoid common application errors caused by parallel execution.

So if you want to run 2 or more tasks asynchronously, you use the method executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);

If your app supports older versions prior to HoneyComb, you can do this kind of check:

Related Posts Plugin for WordPress, Blogger...