Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TakePhotoFromCameraAction1DidFinishTaking event is crashing


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 7 - Last Post: Aug 26, 2016 7:05 AM Last Post By: Fernando Vinici...
Fernando Vinici...

Posts: 4
Registered: 3/21/14
TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 19, 2016 1:01 PM
Hi,

I´m using Firemonkey on Delphi Seattle to build Android apps. I have an app where in a certain moment user is able to take a photo with the phone camera, and after that, the image is saved in a TImage, just like the samples I could see here. The SAME CODE (THEY ARE IDENTICAL) are working in the other forms that I use camera, except one! When user clicks the android button "SAVE" after taking the photo, the app just CLOSES, and freezes the cellphone. I tested with different cellphones, and the behaviour is just the same. The worst thing: this behaviour is random, some times the photo is saved normally in the TImage, but some times this crash happens. Below is the code that I´m using

procedure TmudaFoto_form.TakePhotoFromCameraAction1DidFinishTaking(
  Image: TBitmap);
begin  
  Image1.Bitmap.Assign(Image);  
end;


Thanks,
Fernando
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 20, 2016 9:35 AM   in response to: Fernando Vinici... in response to: Fernando Vinici...
Am 19.08.2016 um 22:01 schrieb Fernando Vinicius Lima Fernandes:
Hi,

I´m using Firemonkey on Delphi Seattle to build Android apps. I have an app where in a certain moment user is able to take a photo with the phone camera, and after that, the image is saved in a TImage, just like the samples I could see here. The SAME CODE (THEY ARE IDENTICAL) are working in the other forms that I use camera, except one! When user clicks the android button "SAVE" after taking the photo, the app just CLOSES, and freezes the cellphone. I tested with different cellphones, and the behaviour is
just the same. The worst thing: this behaviour is random, some times the photo is saved normally in the TImage, but some times this crash happens. Below is the code that I´m using

procedure TmudaFoto_form.TakePhotoFromCameraAction1DidFinishTaking(
  Image: TBitmap);
begin  
  Image1.Bitmap.Assign(Image);  
end;


Thanks,
Fernando

Hello,

I'm not sure where this comes from, but one thing which might help to
further track down this issue is, that you look for monitor.bat in your
Android SDK installation and run it. It will provide you with the option
to view the deboug log output of your connected Android device.

When the app crashes it might provide some log message(s) there which
could be of help.

Greetings

Markus
Fernando Vinici...

Posts: 4
Registered: 3/21/14
Re: TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 22, 2016 4:10 AM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:
Am 19.08.2016 um 22:01 schrieb Fernando Vinicius Lima Fernandes:
Hi,

I´m using Firemonkey on Delphi Seattle to build Android apps. I have an app where in a certain moment user is able to take a photo with the phone camera, and after that, the image is saved in a TImage, just like the samples I could see here. The SAME CODE (THEY ARE IDENTICAL) are working in the other forms that I use camera, except one! When user clicks the android button "SAVE" after taking the photo, the app just CLOSES, and freezes the cellphone. I tested with different cellphones, and the behaviour is
just the same. The worst thing: this behaviour is random, some times the photo is saved normally in the TImage, but some times this crash happens. Below is the code that I´m using

procedure TmudaFoto_form.TakePhotoFromCameraAction1DidFinishTaking(
  Image: TBitmap);
begin  
  Image1.Bitmap.Assign(Image);  
end;


Thanks,
Fernando

Hello,

I'm not sure where this comes from, but one thing which might help to
further track down this issue is, that you look for monitor.bat in your
Android SDK installation and run it. It will provide you with the option
to view the deboug log output of your connected Android device.

When the app crashes it might provide some log message(s) there which
could be of help.

Greetings

Markus

Hi Markus, thanks for the quick answer.

I think I got the solution for my issue, but I´m not sure yet why this happens, but I´m sure that your suggestion would help me to see what is the specific event that crashs the app. But I´m sorry to the stupid/newbie question, but how do I do to monitor the application just like you said? I´ve found the .bat but I don´t know how to use it, even after googling it.

I´m afraid that the crash is caused by the TTimer I have in one specific form that performs a simple check of the Internet Connection in a 10 seconds interval. The TTimer is not in a TThread, so I´m pretty sure this could cause the random crash in different situations. However, just like I said, I would like to see this monitor.bat working to check the specific event that could cause this crash.

Thanks again
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 22, 2016 8:35 AM   in response to: Fernando Vinici... in response to: Fernando Vinici...
Am 22.08.2016 um 13:10 schrieb Fernando Vinicius Lima Fernandes:

Hi Markus, thanks for the quick answer.

I think I got the solution for my issue, but I´m not sure yet why this happens, but I´m sure that your suggestion would help me to see what is the specific event that crashs the app. But I´m sorry to the stupid/newbie question, but how do I do to monitor the application just like you said? I´ve found the .bat but I don´t know how to use it, even after googling it.

I´m afraid that the crash is caused by the TTimer I have in one specific form that performs a simple check of the Internet Connection in a 10 seconds interval. The TTimer is not in a TThread, so I´m pretty sure this could cause the random crash in different situations. However, just like I said, I would like to see this monitor.bat working to check the specific event that could cause this crash.

Thanks again

Hello,

why don't you double click that .bat file?
It will start some GUI after a while.
That GUI has a tab for the log messages and if an Android device in
debugging mode is connected it will soon start to shopw plenty of messages.

Your crash might depend on how you check internet connection from the
TTimer. The OnTimer event of TTimer runs in the main thread.

Good luck.

Greetings

Markus
Fernando Vinici...

Posts: 4
Registered: 3/21/14
Re: TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2016 7:08 AM   in response to: Markus Humm in response to: Markus Humm
Markus Humm wrote:
Am 22.08.2016 um 13:10 schrieb Fernando Vinicius Lima Fernandes:

Hi Markus, thanks for the quick answer.

I think I got the solution for my issue, but I´m not sure yet why this happens, but I´m sure that your suggestion would help me to see what is the specific event that crashs the app. But I´m sorry to the stupid/newbie question, but how do I do to monitor the application just like you said? I´ve found the .bat but I don´t know how to use it, even after googling it.

I´m afraid that the crash is caused by the TTimer I have in one specific form that performs a simple check of the Internet Connection in a 10 seconds interval. The TTimer is not in a TThread, so I´m pretty sure this could cause the random crash in different situations. However, just like I said, I would like to see this monitor.bat working to check the specific event that could cause this crash.

Thanks again

Hello,

why don't you double click that .bat file?
It will start some GUI after a while.
That GUI has a tab for the log messages and if an Android device in
debugging mode is connected it will soon start to shopw plenty of messages.

Your crash might depend on how you check internet connection from the
TTimer. The OnTimer event of TTimer runs in the main thread.

Good luck.

Greetings

Markus

Hi Markus,

I´m using an approach that uses a NetworkState class I found in the Internet, and it´s working properly. It just crashes when I do this check in a 10 seconds interval using TTimer, in the main thread. I suppose that the crash occurs because the TakePhotoAction also is in the main thread so I´ll try to put TTimer in a separated thread. I have also tried to disable the Timer when I do other operations, but unsucessfully.

I´m trying to use and understand the monitor.bat that you mentioned, I have a few random crashes in other forms I hope fix. Do you have some documentation to recommend?

Best regards.
Markus Humm

Posts: 5,113
Registered: 11/9/03
Re: TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2016 1:17 PM   in response to: Fernando Vinici... in response to: Fernando Vinici...
Am 23.08.2016 um 16:08 schrieb Fernando Vinicius Lima Fernandes:
Markus Humm wrote:
Am 22.08.2016 um 13:10 schrieb Fernando Vinicius Lima Fernandes:

Hi Markus, thanks for the quick answer.

I think I got the solution for my issue, but I´m not sure yet why this happens, but I´m sure that your suggestion would help me to see what is the specific event that crashs the app. But I´m sorry to the stupid/newbie question, but how do I do to monitor the application just like you said? I´ve found the .bat but I don´t know how to use it, even after googling it.

I´m afraid that the crash is caused by the TTimer I have in one specific form that performs a simple check of the Internet Connection in a 10 seconds interval. The TTimer is not in a TThread, so I´m pretty sure this could cause the random crash in different situations. However, just like I said, I would like to see this monitor.bat working to check the specific event that could cause this crash.

Thanks again

Hello,

why don't you double click that .bat file?
It will start some GUI after a while.
That GUI has a tab for the log messages and if an Android device in
debugging mode is connected it will soon start to shopw plenty of messages.

Your crash might depend on how you check internet connection from the
TTimer. The OnTimer event of TTimer runs in the main thread.

Good luck.

Greetings

Markus

Hi Markus,

I´m using an approach that uses a NetworkState class I found in the Internet, and it´s working properly. It just crashes when I do this check in a 10 seconds interval using TTimer, in the main thread. I suppose that the crash occurs because the TakePhotoAction also is in the main thread so I´ll try to put TTimer in a separated thread. I have also tried to disable the Timer when I do other operations, but unsucessfully.

I´m trying to use and understand the monitor.bat that you mentioned, I have a few random crashes in other forms I hope fix. Do you have some documentation to recommend?

Best regards.

Hello,

for monitor.bat there is not that much to understand.
Did you already run it via double clicking it?
If yes, did it open after some while?
If your device is connected via USB it should be listed in the GUI of
monitor.bat after some while.

Now what's the issue?

Greetings

Markus
Dave Nottage

Posts: 1,850
Registered: 1/7/00
Re: TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2016 1:36 PM   in response to: Fernando Vinici... in response to: Fernando Vinici...
Fernando Vinicius Lima Fernandes wrote:


I´m using an approach that uses a NetworkState class I found in the Internet, and it´s working properly. It just
crashes when I do this check in a 10 seconds interval using TTimer, in the main thread.

I'm guessing that was my code :-)

Can you post a complete example that reproduces the problem?

--
Dave Nottage [TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog
Fernando Vinici...

Posts: 4
Registered: 3/21/14
Re: TakePhotoFromCameraAction1DidFinishTaking event is crashing  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 26, 2016 7:05 AM   in response to: Dave Nottage in response to: Dave Nottage
Dave Nottage wrote:
Fernando Vinicius Lima Fernandes wrote:


I´m using an approach that uses a NetworkState class I found in the Internet, and it´s working properly. It just
crashes when I do this check in a 10 seconds interval using TTimer, in the main thread.

I'm guessing that was my code :-)

Can you post a complete example that reproduces the problem?

--
Dave Nottage [TeamB]
Hints, tips and tricks at: http://www.delphiworlds.com/blog

Hi everybody,

I´ve changed my approach and I´m not using Timer anymore, and after that, my app stopped crashing. Thanks everybody
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02