Null Pointer Exception

Nyptop

Active Member
Licensed User
Longtime User
I'm having problems with null pointer exceptions and getting confused. Could anyone help?

Thanks
 

Attachments

  • StalkerApp.zip
    56.2 KB · Views: 293

Nyptop

Active Member
Licensed User
Longtime User
My code for chooser_result (chooser is content chooser) if:

B4X:
 Sub chooser_Result (Success As Boolean, Dir As String, FileName As String)
    If Success Then
        bmp.Initialize(File.DirDefaultExternal, bmp)
    Else
        ToastMessageShow("No image selected", True)
    End If
End Sub

Is this what you mean?
 
Upvote 0

Nyptop

Active Member
Licensed User
Longtime User
The bitmap is not setting itself as the background is my problem, not error and the photos are not being taken for some reason. The bitmap is declared in the module 'settings' in process globals. How should I initialise the bitmap and what should go in chooser_result?
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User


The bitmap is not setting to the background because:
B4X:
If settings.bmp.IsInitialized Then
the bitmap is not initialised at Activity_Create

I suggest you initialise bmp from the Main activity to some default bitmap.

I am not sure however what you are trying to do in Activity_Create, it does look confusing.
 
Upvote 0

Nyptop

Active Member
Licensed User
Longtime User
Ok, thanks for the help, but the bitmap is still not loading Also I have set the title to be changed and be full screen at points but this is not what happens on any of the pages. If needed the file is attached,

cheers,

Neil
 
Upvote 0

jparkerri

Member
Licensed User
Longtime User
I'm getting the Null Exception Pointer error when I start up my app immediately after closing it. When I exit from an app, do I need to do a lot of cleanup like:
Activity.FInish, Remove Views, etc?
The normal sequence is:
I start the app successfully and it works fine.
I quit the app calling Activity.FInish.
I start it up again and get the Null Exception Pointer error.
Only after I click NO when it asks to Continue? can I then start it up again successfully.

When my app starts, it opens a Label in a view that is white. When it fails, the area does not go white as though the View is not initialized.

Any suggestions on what to check?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
compile it in debug-mode and have a look at the unfiltered log... The must shown something where the exception happens... From this info you maybe know where the nullpointer (possibly not initialized object) appears..

Maybe the app is not really killed from androidsystem after your Activity.finish... It may killed when android want it to kill....

In that case your app is "paused"... And if you then "restart" the app it is not really started. It comes out of a pause. activity_create is possibly not called. Just activity_resume...
But this you can find out in debuglog too
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…