Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9011619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:47:03+00:00 2026-06-16T02:47:03+00:00

To test out in app billing v3 for Android I implemented a dialog which

  • 0

To test out in app billing v3 for Android I implemented a dialog which adds a single choice items adapter. I’ve added the test Skus, “android.test.purchased”, “android.test.canceled”, “android.test.refunded”, “android.test.item_unavailable”.

When I use the dialog to launch a purchase flow everything is fine, I am able to purchase the item and the item is most definitely purchased. However, I get a nullpointerexception when my app then tries to refresh the UI. I know the refresh works.

Here’s my logcat:

12-16 01:06:06.706: I/Running inventory query with(20846): android.test.purchased
12-16 01:06:06.706: I/Running details query with(20846): SkuDetails:{"title":"Sample Title","price":"£0.61","type":"inapp","description":"Sample description for product: android.test.purchased.","productId":"android.test.purchased"}
12-16 01:06:06.706: I/Running details query with(20846): SkuDetails:{"title":"Sample Title","price":"£0.61","type":"inapp","description":"Sample description for product: android.test.purchased.","productId":"android.test.purchased"}
12-16 01:06:06.706: I/Running inventory query with(20846): android.test.canceled
12-16 01:06:06.706: I/Running details query with(20846): null
12-16 01:06:06.706: I/Running details query with(20846): null
12-16 01:06:06.706: D/AndroidRuntime(20846): Shutting down VM
12-16 01:06:06.706: W/dalvikvm(20846): threadid=1: thread exiting with uncaught exception (group=0x40d12930)
12-16 01:06:06.706: E/AndroidRuntime(20846): FATAL EXCEPTION: main
12-16 01:06:06.706: E/AndroidRuntime(20846): java.lang.NullPointerException
12-16 01:06:06.706: E/AndroidRuntime(20846): at com.example.test.MainActivity$1.onQueryInventoryFinished(MainActivity.java:201)
12-16 01:06:06.706: E/AndroidRuntime(20846): at com.example.test.util.IabHelper$2$1.run(IabHelper.java:536)
12-16 01:06:06.706: E/AndroidRuntime(20846): at android.os.Handler.handleCallback(Handler.java:725)
12-16 01:06:06.706: E/AndroidRuntime(20846): at android.os.Handler.dispatchMessage(Handler.java:92)
12-16 01:06:06.706: E/AndroidRuntime(20846): at android.os.Looper.loop(Looper.java:137)
12-16 01:06:06.706: E/AndroidRuntime(20846): at android.app.ActivityThread.main(ActivityThread.java:5039)
12-16 01:06:06.706: E/AndroidRuntime(20846): at java.lang.reflect.Method.invokeNative(Native Method)
12-16 01:06:06.706: E/AndroidRuntime(20846): at java.lang.reflect.Method.invoke(Method.java:511)
12-16 01:06:06.706: E/AndroidRuntime(20846): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-16 01:06:06.706: E/AndroidRuntime(20846): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-16 01:06:06.706: E/AndroidRuntime(20846): at dalvik.system.NativeStart.main(Native Method)

for (String s : allSkus) {
Log.i("Running inventory query with", "" + s);
SkuDetails c = inv.getSkuDetails(s);
Log.i("Running details query with", "" + c);
if (inv.hasPurchase(s)) {
    purchaseArray.add(c.getTitle());
} else {
    **LINE 201** objects.add(c.getPrice() + "  T:" + c.getSku());
}

allSkus is an ArrayList which holds the 4 skus above.

The nullpointer is
SkuDetails c = inv.getSkuDetails(s);

Which returns null on the UI refresh. But the issue is that it seems to work for the first sku (android.test.purchased) but is null for the second sku (android.test.canceled) and that too it is only null when it runs after having bought another item (refunded or purchased). However if I subsequently open it again, it’s fine and no nullpointerexception is thrown.

If I add a null check before adding to the ArrayList objects, then no items are added as every item after or before the bought item is returning null on inv.getSkuDetails(s)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:47:04+00:00Added an answer on June 16, 2026 at 2:47 am

    Figured it out, leaving this for anyone who has the same problem as me. In the UI refresh I was calling the IabHelper query without querying the details of the skus. Thus precached skus had details, but those that weren’t, failed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to test in-app billing in my Android application. The problem is,
I've just build a sample application to test out google app engine and google
I have built part of my app and wanted to test it out. All
We're trying to set up Spring-Test-MVC for our Spring-MVC web app. We started out
I'm having a problem integrating iCloud with my app. When I set test out
I tried out an app to test bluetooth communication. It is a simple app
So I have in-app-billing working with PHP server verify. However, I cant figure out
I uploaded my application to test the in-app billing; specifically, a monthly subscription. I
I've done this simple app in Gtk, just to test things out... I come
I frequently find myself making a dummy console app to test something simple out.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.