N Nyptop Active Member Licensed User Longtime User Dec 27, 2011 #1 I'm having problems with null pointer exceptions and getting confused. Could anyone help? Thanks Attachments StalkerApp.zip StalkerApp.zip 56.2 KB · Views: 380
NJDude Expert Licensed User Longtime User Dec 27, 2011 #2 The culprit is somewhere here: Code: Copy Sub mainpanel_click Activity.LoadLayout("StalkScreen") For LoopStopper = 1 To 1 camera1.Quality = C1Q timer1.Initialize ("Timer1" , Speed) timer1.Enabled = True camera1.TakePicture timer1.Enabled = True Next End Sub First of all, I don't know why you are using a For...Next, second, you have a timer but do not have a Timer1_Tick routine. It seems to me the camera part has a problem, if I comment the lines as shown below it seems to work, but you are not verifying if someone didn't select a file (tapping on the panel, then click on VIEW button and then the BACK button on the device) that also gives an error. Code: Copy Sub mainpanel_click Activity.LoadLayout("StalkScreen") 'For LoopStopper = 1 To 1 'camera1.Quality = C1Q timer1.Initialize ("Timer1" , Speed) timer1.Enabled = True 'camera1.TakePicture 'timer1.Enabled = True 'Next End Sub ... Sub Timer1_Tick 'You don't have this routine in your code. ToastMessageShow("Tick...", False) End Sub I hope that helps you out. Last edited: Dec 27, 2011 Upvote 0
The culprit is somewhere here: Code: Copy Sub mainpanel_click Activity.LoadLayout("StalkScreen") For LoopStopper = 1 To 1 camera1.Quality = C1Q timer1.Initialize ("Timer1" , Speed) timer1.Enabled = True camera1.TakePicture timer1.Enabled = True Next End Sub First of all, I don't know why you are using a For...Next, second, you have a timer but do not have a Timer1_Tick routine. It seems to me the camera part has a problem, if I comment the lines as shown below it seems to work, but you are not verifying if someone didn't select a file (tapping on the panel, then click on VIEW button and then the BACK button on the device) that also gives an error. Code: Copy Sub mainpanel_click Activity.LoadLayout("StalkScreen") 'For LoopStopper = 1 To 1 'camera1.Quality = C1Q timer1.Initialize ("Timer1" , Speed) timer1.Enabled = True 'camera1.TakePicture 'timer1.Enabled = True 'Next End Sub ... Sub Timer1_Tick 'You don't have this routine in your code. ToastMessageShow("Tick...", False) End Sub I hope that helps you out.
N Nyptop Active Member Licensed User Longtime User Dec 27, 2011 #3 Ok thanks, but I want the app to take a photo, wait the specified time and keep on taking photos until the user stops the process. How should I go about this? Also, I believe the problem lay specifically with the setting of the camera quality, what was I doing wrong their? Thanks for the help Upvote 0
Ok thanks, but I want the app to take a photo, wait the specified time and keep on taking photos until the user stops the process. How should I go about this? Also, I believe the problem lay specifically with the setting of the camera quality, what was I doing wrong their? Thanks for the help
NJDude Expert Licensed User Longtime User Dec 27, 2011 #4 The attached project is a simple automatic camera that snaps a picture every 5 seconds, that will give you an idea. Attachments AutoSnapshot.zip AutoSnapshot.zip 6.7 KB · Views: 348 Upvote 0
The attached project is a simple automatic camera that snaps a picture every 5 seconds, that will give you an idea.
N Nyptop Active Member Licensed User Longtime User Dec 28, 2011 #5 This is great thankyou very much Upvote 0
N Nyptop Active Member Licensed User Longtime User Dec 28, 2011 #6 I'm still getting the issue of Null pointer exception. The issue no longer lies with the camera1.quality, it lies with the camera1.takepicture. Thanks For the help and sorry about all the questions but I think I'm getting there. Upvote 0
I'm still getting the issue of Null pointer exception. The issue no longer lies with the camera1.quality, it lies with the camera1.takepicture. Thanks For the help and sorry about all the questions but I think I'm getting there.
NJDude Expert Licensed User Longtime User Dec 28, 2011 #7 My sample uses the "official" camera library, what's the one you are using? but if you say you are having problems during TakePicture (NullException), reboot your phone, that should solve that problem. Last edited: Dec 28, 2011 Upvote 0
My sample uses the "official" camera library, what's the one you are using? but if you say you are having problems during TakePicture (NullException), reboot your phone, that should solve that problem.
N Nyptop Active Member Licensed User Longtime User Dec 28, 2011 #8 I have rebooted a couple of times and it is still not working I have also removed the quality function so that I can use the standard camera library but the problem persists. I have been playing around a lot with the code but that still hasn't worked. Attached is as far as I have gotten. Attachments StalkerApp1.zip StalkerApp1.zip 56.3 KB · Views: 338 Upvote 0
I have rebooted a couple of times and it is still not working I have also removed the quality function so that I can use the standard camera library but the problem persists. I have been playing around a lot with the code but that still hasn't worked. Attached is as far as I have gotten.
NJDude Expert Licensed User Longtime User Dec 28, 2011 #9 Ok, by looking at your code I see a problem, if you want different layouts you have to either put them on different activities or use panels, that's the problem you are having. Upvote 0
Ok, by looking at your code I see a problem, if you want different layouts you have to either put them on different activities or use panels, that's the problem you are having.
N Nyptop Active Member Licensed User Longtime User Dec 28, 2011 #10 Thanks NJDude, I have changed it so as that there are different activities. however, the problem persists. I am still getting Null pointer exception. Would anyone minded testing the app as it stands on their device just so I know that where the problem lies (code or device) and if its not to much effort suggest a possible solution for me to work on? Thanks Attachments stalkerapp2.zip stalkerapp2.zip 57.5 KB · Views: 345 Upvote 0
Thanks NJDude, I have changed it so as that there are different activities. however, the problem persists. I am still getting Null pointer exception. Would anyone minded testing the app as it stands on their device just so I know that where the problem lies (code or device) and if its not to much effort suggest a possible solution for me to work on? Thanks
NJDude Expert Licensed User Longtime User Dec 28, 2011 #11 Well, it was failing because you forgot to add a few things, check the attached project and look at the "StalkScreen" activity, I made notes pointing out what you forgot. Attachments Stalker_FIXED.zip Stalker_FIXED.zip 57.7 KB · Views: 366 Upvote 0
Well, it was failing because you forgot to add a few things, check the attached project and look at the "StalkScreen" activity, I made notes pointing out what you forgot.
N Nyptop Active Member Licensed User Longtime User Dec 28, 2011 #12 Thanks, you have been really helpful Upvote 0
U unba1300 Guest Dec 28, 2011 #14 NJDude said: Ok, by looking at your code I see a problem, if you want different layouts you have to either put them on different activities or use panels, that's the problem you are having. Click to expand... Is it really necessary to use more than one activity or panels when using more than one layout? I've been using a Sub ('remove all views') each time just before loading a different layout. Is this not a good approach? Thanks. Upvote 0
NJDude said: Ok, by looking at your code I see a problem, if you want different layouts you have to either put them on different activities or use panels, that's the problem you are having. Click to expand... Is it really necessary to use more than one activity or panels when using more than one layout? I've been using a Sub ('remove all views') each time just before loading a different layout. Is this not a good approach? Thanks.
NJDude Expert Licensed User Longtime User Dec 28, 2011 #15 It's better because it allows you maintain and debug your app more efficiently, at least, that's my opinion. In this case, there is a timer updating a view, by removing it, it causes the app to fail. Last edited: Dec 28, 2011 Upvote 0
It's better because it allows you maintain and debug your app more efficiently, at least, that's my opinion. In this case, there is a timer updating a view, by removing it, it causes the app to fail.
N Nyptop Active Member Licensed User Longtime User Dec 29, 2011 #16 With the different activities I have a new problem: Say a Bitmap is saved in the 'settings' activity how could we access it from other activities? Upvote 0
With the different activities I have a new problem: Say a Bitmap is saved in the 'settings' activity how could we access it from other activities?
NJDude Expert Licensed User Longtime User Dec 29, 2011 #17 A file (Bitmap, text, etc) is saved to File.DirRootExternal, File.DirDefaultExternal, etc, so, it can accessed from any activity. Upvote 0
A file (Bitmap, text, etc) is saved to File.DirRootExternal, File.DirDefaultExternal, etc, so, it can accessed from any activity.
N Nyptop Active Member Licensed User Longtime User Dec 30, 2011 #18 Ok thanks, but how do I carry an 'int' into another activity? Upvote 0
NJDude Expert Licensed User Longtime User Dec 30, 2011 #19 Variables can be accessed from any activity if they are define in Process_Globals. Better check some documentation an samples using the search feature of this forum. Last edited: Dec 30, 2011 Upvote 0
Variables can be accessed from any activity if they are define in Process_Globals. Better check some documentation an samples using the search feature of this forum.
N Nyptop Active Member Licensed User Longtime User Jan 1, 2012 #20 Sorry, I miss-phrased my question but I have the answer now: thanks for the help In the sub chooser_result the code is as follows: Code: Copy Sub chooser_Result (Success As Boolean, Dir As String, FileName As String) If Success Then bmp.Initialize(File.DirDefaultExternal, FileName) Else ToastMessageShow("No image selected", True) End If End Sub Then when I use 'bmp' the code is: Code: Copy Sub Activity_Create(FirstTime As Boolean) PictureCounter = 0 If settings.bmp.IsInitialized Then Camera1.Quality = settings.Q Activity.LoadLayout("StalkScreen") activity.SetBackgroundImage (settings.bmp) stalkscreen.SetBackgroundImage (settings.bmp) Camera1.Initialize(StalkScreen, "Camera1") Timer1.Initialize ("Timer1", settings.timerinterval) Timer1.Enabled = True Else Msgbox ("Please select an image" ,"") StartActivity ("settings") End If End Sub The image is not loading to the background though. Could you point me in the correct direction as to what to do. Thanks again, Neil Upvote 0
Sorry, I miss-phrased my question but I have the answer now: thanks for the help In the sub chooser_result the code is as follows: Code: Copy Sub chooser_Result (Success As Boolean, Dir As String, FileName As String) If Success Then bmp.Initialize(File.DirDefaultExternal, FileName) Else ToastMessageShow("No image selected", True) End If End Sub Then when I use 'bmp' the code is: Code: Copy Sub Activity_Create(FirstTime As Boolean) PictureCounter = 0 If settings.bmp.IsInitialized Then Camera1.Quality = settings.Q Activity.LoadLayout("StalkScreen") activity.SetBackgroundImage (settings.bmp) stalkscreen.SetBackgroundImage (settings.bmp) Camera1.Initialize(StalkScreen, "Camera1") Timer1.Initialize ("Timer1", settings.timerinterval) Timer1.Enabled = True Else Msgbox ("Please select an image" ,"") StartActivity ("settings") End If End Sub The image is not loading to the background though. Could you point me in the correct direction as to what to do. Thanks again, Neil