0
votes

Well in program, I am using In app billing. After QueryInventoryFinishedListener I want to change user interface. So I made like this. but it gives this error.

@Override
    protected Void doInBackground(Void... params) {
        mHelper.queryInventoryAsync(mGotInventoryListener);
        return null;
    }

@Override
    protected void onPostExecute(Void result) {
        updateUserinterface();
        super.onPostExecute(result);
    }

E/AndroidRuntime(26593): FATAL EXCEPTION: AsyncTask #1 E/AndroidRuntime(26593): java.lang.RuntimeException: An error occured while executing doInBackground() E/AndroidRuntime(26593): at android.os.AsyncTask$3.done(AsyncTask.java:299) E/AndroidRuntime(26593): at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273) E/AndroidRuntime(26593): at java.util.concurrent.FutureTask.setException(FutureTask.java:124) E/AndroidRuntime(26593): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307) E/AndroidRuntime(26593): at java.util.concurrent.FutureTask.run(FutureTask.java:137) E/AndroidRuntime(26593): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) E/AndroidRuntime(26593): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) E/AndroidRuntime(26593): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) E/AndroidRuntime(26593): at java.lang.Thread.run(Thread.java:856) E/AndroidRuntime(26593): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

If I didnt use doInBacground() class sometimes some premium stuff showing like not purchased already. I want to prevent this. Do you have any idea?

1

1 Answers

0
votes

"After QueryInventoryFinishedListener I want to change user interface." So why you don't do it then?

You are updating UI in onPostExecute, not in onQueryInventoryFinished...why not?

Besides, .queryInventoryAsync() runs in background, that's why it's called Async... no need for another background thread around it.