Java Question NullPointerException error in my library.

DevBaby

Active Member
Licensed User
Longtime User
Hi,

I created a library to show ads to the user.The library I created is below, I get a NullPointerException error when calling ShowOfferWall(String USERID)

I am calling this function with

Dim MySponsorPay As SponsorPay ' done in Process_Globals
MySponsorPay.ShowOfferWall(UserID)


B4X:
package com.B4ASponsorpay.sdk;

import android.content.Intent;
import android.app.Activity;
import anywheresoftware.b4a.BA;
import anywheresoftware.b4a.BA.DependsOn;
import anywheresoftware.b4a.BA.Permissions;
import anywheresoftware.b4a.BA.ShortName;
import anywheresoftware.b4a.BA.Version;

import com.sponsorpay.sdk.android.publisher.SponsorPayPublisher;

@DependsOn(values={"sponsorpay-android-sdk"})
@Permissions(values={"android.permission.INTERNET", "android.permission.ACCESS_WIFI_STATE", "android.permission.READ_PHONE_STATE"})
@ShortName("SponsorPay")
@Version(1.0f)

public class BaseCall extends Activity {

   private String PassUserId;   
   
/**
 * Call to show offerwall to user  
 */
   
   public void ShowOfferWall(String UserId){

      PassUserId = UserId;
      
      Intent offerWallIntent = SponsorPayPublisher.getIntentForOfferWallActivity(BA.applicationContext.getApplicationContext(), PassUserId);
       
      startActivityForResult(offerWallIntent, SponsorPayPublisher.DEFAULT_OFFERWALL_REQUEST_CODE);
    
    }
    
}


I believe the error is occurring with...

startActivityForResult(offerWallIntent, SponsorPayPublisher.DEFAULT_OFFERWALL_REQUEST_CODE);
 
Last edited:
Top