Bug? Ayuda - CamaraEx -java.lang.nullPointerException

Julio Ochoa

Member
Licensed User
Longtime User
muy buenas,

Tengo una aplicación con 15 actividades secuenciales, 4 de ellas son fotos (activan la camara). Me está pasando que la apliación toma bien las fotos y las guarda en disco, pero en una segunda toma de datos el evento Camera1_PictureTaken recibe en el parametro DATA un valor Null, es decir, se dispara la camara, se dispara el evento Camera1_PictureTaken pero realmente no viene la foto. por lo general tengo que salir de la aplicación o apagar el equipo para que neuvamente permita tomar las fotos. Y el problema se repite, en la siguientes tomas de datos cuando llego a la fotos a veces (no es siempre) se daña el proceso. Alguien tiene idea que puede ser? es urgente!!!!
 

Julio Ochoa

Member
Licensed User
Longtime User
I have a big problem with my app.. I attached a demo. I have 6 acitivities (Main-Menu --> Info1 --> Photo1 --> photo2--> photo3--> photo4 --> Main-Menu). I can take data using this process 2 or 3 times in the same executing, but after that the camara is reciving Null in the data parameter in Camera1_PictureTaken, and after that I have to reeboot the device or exit from the app and wait many minutes... and it will work again.

Please, Please... I had many weeks trying to fix and I couldn't!!!!!!!! I have tested many alternatives but I am new in Basic4Android....

The process for testing is:
1. In main menu, clik in NUEVO
2. Fill the step 1 (any text). CLik in >> button
3. Take the photo1 with the second ICON. Click in >> button for continue to the next screen
4. Take the photo2 with the second ICON. Click in >> button for continue to the next screen
5. Take the photo3 with the second ICON. Click in >> button for continue to the next screen
6. Take the photo4 with the second ICON. Click in LAST button for close and return to the MENU

Repeat the process 3 times (or 4) and in some photo will crash (I control with Try..but the Data is Null in Camera1_PictureTaken.

Please, Help me, I appreciated very much.
 

Attachments

  • CapturaDemo2.zip
    441.6 KB · Views: 303

Julio Ochoa

Member
Licensed User
Longtime User
More information.. in Real app, Between each pair of photos there are more forms (activities) .ie. Photo1 --> OtherForm --> OtherForm --> Photo2 --> OtherForm--> Photo3..., but I reduced the demo for more easier to test.
Thks,
 

Julio Ochoa

Member
Licensed User
Longtime User
This is a small demo (without GPS, show the picture,..) It continues without works.. I did this test:
1. In main menu, clik in NUEVO
2. Fill the step 1 (any text). CLik in >> button. or >> button witoout fill any text
3. Take the photo1 with the second ICON. Click in >> button for continue to the next screen
4. Take the photo2 with the second ICON. Click in >> button in square button

I repeated the process 6 times and the problem arrise (Data is null). I think the problem can be in the way I am managing the activities or the way I am realeasing or initialiting the camera.. any help?
 

Attachments

  • CapturaDemo4.zip
    436.2 KB · Views: 260

Julio Ochoa

Member
Licensed User
Longtime User
Thks Erel. ¿How can I get the full error? I am executing the APP in a device (GPS Trimble Juno 5 with Android 4.1.2). Pls, could you tell me in wich directory can I get the full error? or the procedure for getting it?
 

Julio Ochoa

Member
Licensed User
Longtime User
Hi erel,

The problem is that when camera start to fail it doesnt send a error... The only evidence is that when I fire camera1.TakePicture, in the "Sub Camera1_PictureTaken (Data() As Byte)" the Data variable is Null.

I get the evidence using:
If Data = Null Then
Msgbox("NULL NULL NULL Vuelva a intentarlo","")
Return
End If

The error java.lang.nullPointerException is when I tryied to use the Data variable (i.e Data.lenght).
 

Julio Ochoa

Member
Licensed User
Longtime User
How can I monitoring the memory while the app is running? the idea is review if there is memory problems.... thks
 

Julio Ochoa

Member
Licensed User
Longtime User
GC_CONCURRENT freed 384K, 9% free 8212K/8967K, paused 2ms+3ms, total 24ms
** Activity (p4_foto1) Pause, UserClosed = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (p1_fuerza) Create, isFirst = false **
** Activity (p1_fuerza) Resume **
** Activity (p1_fuerza) Pause, UserClosed = true **
** Activity (p4_foto1) Create, isFirst = false **
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory.
Downsampling image due to lack of memory: 2
Downsampling image due to lack of memory: 4
** Activity (p4_foto1) Resume **

After taking some photos the system said Downsampling image due to lack of memory: 2 (pls see attached file). after that the Data is null in picture_taken
 

Attachments

  • log2_trimble.txt
    4 KB · Views: 296

Julio Ochoa

Member
Licensed User
Longtime User
Another question... if the device has 256 MB RAM, and I dont have many apps installed (its a new device I have only 2 apps installed by me), why when I execute the app the IDE says: GC_CONCURRENT freed 384K, 9% free 8212K/8967K. Only 8.9 MB in total? and used 8.2MB? wich is the criteria for showing this total memory if the device has more memory apparently.
 

Julio Ochoa

Member
Licensed User
Longtime User
I think that I could solve the problem (I am doing more tests)... I had to use ExitApplication instead of Activity.Finish in some places .. this command free the memory (erase global variables too) and with some control into the source code the process can take place many times without problem with the memory.

Ariel, is good to use this sentence (ExitApplication), what is the positive and negative impact to use this sentence (because in some post of this foro some people says that is not recommendable to use it)..
 
Top