Android Question NullPointer Error with Sliding Panel


Licensed User
Longtime User
All, I could use a little help. I have an app that will be used to track writer submissions to magazines. It consists of three panels. The first (Main) is a ListView with progress bars for tracking submission time. The second panel is a story submission form and the third panel is to input new publications information.

Originally, I used the menu button to go to the different panels, and it mostly worked, except for updates to the Main page. I thought it would be slicker to use sliding panels instead.

I've integrated the sliding panel demo, but when I run it, I get a java.lang.NullPointerException on the line with bar.Initialize("bar"). Part of the code is here:

Sub Process_Globals
Private currentPage As Int
End Sub

Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim scvMain As ScrollView
Dim Timer1 As Timer
Dim pnlPage1, pnlPage2, pnlPage3 As Panel ' Declares the three panels

Private bar As StdActionBar
Private vp As StdViewPager
End Sub

Sub Activity_Create(FirstTime As Boolean)
Dim height As Int = CalculateHeight(True, True)

If FirstTime Then
' File.Delete(File.DirDefaultExternal, SubFileName) ' for testing Deletes old database
' File.Delete(File.DirDefaultExternal, PubFileName) ' for testing Deletes old database

If File.Exists(File.DirDefaultExternal, SubFileName) = False Then ' remark during testing
DBFileDir = DBUtils.CopyDBFromAssets(SubFileName)
DBFileDir = DBUtils.CopyDBFromAssets(PubFileName)
End If ' remark during testing
SQL1.Initialize(DBFileDir, SubFileName, True)
SQL2.Initialize(DBFileDir, PubFileName, True)
End If

vp.Initialize("vp", 3, 100%x, height)
Activity.AddView(vp.AsView, 0, 0, 100%x, height)
'load the pages layouts
' bar.Icon = LoadBitmap(File.DirAssets, "ic_action_user.png")
bar.NavigationMode = bar.NAVIGATION_MODE_TABS
bar.AddTab("Tab 1")
bar.AddTab("Tab 2")
bar.AddTab("Tab 3")
bar.ShowUpIndicator = True
bar.SelectedIndex = currentPage
Activity.Title = "This is the title"
bar.Subtitle = "This is the subtitle"
' Activity.AddMenuItem3("", "mnuEdit", LoadBitmap(File.DirAssets, "ic_action_edit.png"), True)
' Activity.AddMenuItem3("", "mnuNew", LoadBitmap(File.DirAssets, "ic_action_new.png"), True)
' Activity.AddMenuItem3("", "mnuUndo", LoadBitmap(File.DirAssets, "ic_action_undo.png"), True)
Activity.AddMenuItem("Enter Submissions","mnuPage2") ' Adds menu item mnuPage2
Activity.AddMenuItem("Edit Publications","mnuPage3") ' Adds menu item mnuPage3

I've include the StdActionBar (version 1.50). What am I missing?

Thanks for all the help!