Win a copy of Programming with Types this week in the Angular and TypeScript forum
or The Design of Web APIs in the Web Services forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Joe Ess
  • salvin francis

Why is my apiController returning null?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did a breakpoint where I am calling the presenter.getOrderItemCO() to update the shopAdapter I am using to display the items I needed.

PROBLEM: App crashes on ONRESUME()

Here is my code for ViewReceiptActivity.class



This is my ViewReceiptPresenter.class where I need to get all the Job Orders related to one checkout, as well as the deliverables needed.



This is what my logcat says:

E/AndroidRuntime: FATAL EXCEPTION: main
   Process: com.metromart.metromart_stg, PID: 32135
   java.lang.RuntimeException: Unable to resume activity {com.metromart.metromart_stg/com.metromart.metromart.ui.mart.activity.viewreceipt.ViewReceiptActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.metromart.metromart.api.controller.ApiController.getCheckoutByID(java.lang.String, java.lang.String, com.metromart.metromart.ui.mart.listener.CallbackListener$SingleEntityListener)' on a null object reference
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3581)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
       at android.app.ActivityThread.-wrap11(Unknown Source:0)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:6494)
       at java.lang.reflect.Method.invoke(Native Method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.metromart.metromart.api.controller.ApiController.getCheckoutByID(java.lang.String, java.lang.String, com.metromart.metromart.ui.mart.listener.CallbackListener$SingleEntityListener)' on a null object reference
       at com.metromart.metromart.ui.mart.activity.viewreceipt.ViewReceiptActivityPresenter.getOrderItemCO(ViewReceiptActivityPresenter.java:190)
       at com.metromart.metromart.ui.mart.activity.viewreceipt.ViewReceiptActivity.onResume(ViewReceiptActivity.java:64)
       at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1355)
       at android.app.Activity.performResume(Activity.java:7117)
       at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
       at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621) 
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862) 
       at android.app.ActivityThread.-wrap11(Unknown Source:0) 
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
       at android.os.Handler.dispatchMessage(Handler.java:106) 
       at android.os.Looper.loop(Looper.java:164) 
       at android.app.ActivityThread.main(ActivityThread.java:6494) 
       at java.lang.reflect.Method.invoke(Native Method) 
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 


 
Saloon Keeper
Posts: 5982
154
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is "apiController" null?
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!