How to close Android App ??

XE5 Firemonkey Android app...

I can not close the App by method of  [Application.Terminate;]  or [Form1.Close; ] ...and so on

How to close Android App ??
0
Sang
10/2/2013 2:38:22 AM
embarcadero.delphi.firemonkey 4901 articles. 4 followers. Follow

7 Replies
6169 Views

Similar Articles

[PageSpeed] 56

> {quote:title=Sang Hyun Oh wrote:}{quote}
> XE5 Firemonkey Android app...
> 
> I can not close the App by method of  [Application.Terminate;]  or [Form1.Close; ] ...and so on
> 
> How to close Android App ??

Confirm. I cannot close Android Delphi's App on Android too.
It's look like very strange but I think it is a behaviour of Android's tasks architechture, it determines by itself what application must be closed or not.
0
Aleks
10/7/2013 4:31:02 AM
> It's look like very strange but I think it is a behaviour of Android's tasks architechture, it determines by itself what application must be closed or not.

I've used some apps on Android that prompted me to Exit the app as soon as I pressed the Back button while the focus was on the main window.
0
costa
10/7/2013 11:39:05 PM
this werks for me:
{code}
 try
     formandroid.Hide;

     Application.MainForm.DisposeOf;

     except

   on e:exception do
      begin
       Application.MainForm.DisposeOf;
      end;
   end;
{code}
0
Brian
10/8/2013 3:52:37 AM
Brian wrote:

> this werks for me:

That logic does not make sense to me.  If Hide() raises an exception, DisposeOf() 
gets called, but that can raise an exception then is not caught.  On the 
other hand, if the first DisposeOf() raises an exception, it gets called 
a second time, but that can raise an exception that is not caught.  Either 
way, you risk crashing the main thread.  That kind of logic can be better 
handled like this:

{code:delphi}
try
  formandroid.Hide;
finally
  Application.MainForm.DisposeOf;
end;
{code}

Or maybe:

{code:delphi}
try
  try
    formandroid.Hide;
  finally
    Application.MainForm.DisposeOf;
  end;
except
end;
{code}

--
Remy Lebeau (TeamB)
0
Remy
10/8/2013 7:00:31 AM
the first dispose of sometimes would raise an exception, which is then caught, to try that again...it does not then raise another one..

the code I have posted here works no problem here 
(its used on the keyup back button from the main form)

with that code not in use then the back button closing the app (i.e un handled) causes the app to crash on either the next restart or the next restart after that
(due to an unhandled memory errro on close)

for my app at least
(a simple hello world app is OK though)
(I have tried freeing created objects at start up on the form destroy (like the ini file that is created) but that did not help)
(I have probably not done something correct)

Edited by: Brian Hamilton on Oct 8, 2013 12:38 AM
0
Brian
10/8/2013 7:40:11 AM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> Brian wrote:
> 
> > this werks for me:
> 
> That logic does not make sense to me.  If Hide() raises an exception, DisposeOf() 
> gets called, but that can raise an exception then is not caught.  On the 
> other hand, if the first DisposeOf() raises an exception, it gets called 
> a second time, but that can raise an exception that is not caught.  Either 
> way, you risk crashing the main thread.  That kind of logic can be better 
> handled like this:
> 
> {code:delphi}
> try
>   formandroid.Hide;
> finally
>   Application.MainForm.DisposeOf;
> end;
> {code}
> 
> Or maybe:
> 
> {code:delphi}
> try
>   try
>     formandroid.Hide;
>   finally
>     Application.MainForm.DisposeOf;
>   end;
> except
> end;
> {code}
> 
> --
> Remy Lebeau (TeamB)

Thanks but It raise an exception... system halted.
0
Sang
10/8/2013 10:47:24 AM
Sang wrote:

> Thanks but It raise an exception... system halted.

I suggest you try tracing into DisposeOf() and find out why it is crashing 
in the first place.  It should not be, unless it is being called on an invalid 
object, or doing something internally that it should not be doing.  Either 
way, it is a bug that needs fixing.

--
Remy Lebeau (TeamB)
0
Remy
10/8/2013 5:23:01 PM
Reply:

Similar Artilces:

How to fully close a Delphi-XE5 Android App?
This has been asked before but not fully answered. I want to exit an app for two reasons. 1. on startup if problems with the data files and (I'd also like to know to handle this case on IOS too!) 2. from a back-button press Other answere here and elsewhere got answers of using: SharedActivity.Finish; or MainActivity.Finish; Both appear to close the window but neither exit the application as in debug mode the program does not end in Delphi and the application is still running on the device itself. The apps seem to eventually go away when in that state, but if you tr...

[SOLVED] Delphi XE5
Hello, I have a very simple program that works perfectly. But if I add a TIdTcpClient component on my form, with no change in the properties or event, just add it, then application crash when exiting with the hardware return button. What is wrong ? thank you Franck {code} unit FormTestModbusXE; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.TabControl, FMX.StdCtrls, FMX.Edit, FMX.Layouts, FMX.ListBox, IdBaseComponent, IdComponent, IdTCPConnection, Id...

XG Mobile App (Delphi XE2/Firemonkey ) now in the app store
My app is finally in the App Store. My thanks go to forum members for the help provided in all the post here. Xavier Dufaure de Citres ----- _*XG Mobile for iPhone, iPad and iPod Touch now in the App Store*_ XG Mobile is the portable version of the acclaimed program "eXtreme Gammon" for PC. You can now have the power and accuracy of eXtreme Gammon in the palm of your hands. In its few years of existence (since 2009) eXtreme gammon has been recognized as the best backgammon program available. This has been confirmed by top players in the world and by independen...

Get the fat out from XE5 Android apps
In the modern mobile OSes (like iOS and Android) the applications are run into a sandbox for more control, security and performance reasons and there are no (easy) ways to separate/use a "runtime" library (in Delphi's case RTL + FireMonkey) to be shared by multiple apps. This problem is common to all mobile x-plat runtimes/wrappers like Adobe AIR (http://www.adobe.com/products/air.html) or Mono (http://www.mono-project.com). In Delphi's case the problem with the increasingly fat apps (statically linking RTL + FireMonkey to the application binary) comes from the non-optimi...

Closing App on Android
I have a button with the Close method. When I press it on Andriod, it does not close the app. I see it stop on the Close statement repeatedly, but when I continue with Run it does not close. Try Application.Terminate; > {quote:title=Douglas Downs wrote:}{quote} > I have a button with the Close method. When I press it on Andriod, it does not close the app. I see it stop on the Close statement repeatedly, but when I continue with Run it does not close. > Try Application.Terminate; that does not work an unhandled user called back button on mainform will cose the app...

Android App does not close...
I am experimenting with Android App development in XE5 and I noted a strange thing that confuses me a lot. In Windows programs whenever you close the main form the application exits. But when I put Close; in the OnClick event of a button the application does not react at all when that button is tapped, why is it like that? And how can I close the app properly? I do not want it to stay running in the background, which will happen if I switch to the home page for instance. -- Bo Berglund Developer in Sweden ...

Does an android app created with Delphi XE5, XE6 run on Android 5 without modifications?
Is a FireMonkey NDK application forward compatible as much as a JDK one? Markus wrote: > Android changed the JVM from Dalvik to another one (just forgot the > name) The new runtime is called ART. > and that caused issues with Delphi based programs which had any > images in them as TImage.LoadFromStream didn't work properly > anymore and a few small other issues. But that was not a problem with the NDK itself. Just that there was a new runtime underneath the NDK, and FMX was making some assumptions that work under Dalvik but not under ART. -- Remy ...

Delphi app not closing properly
I am the developer of a widely distributed application written in Delphi 5. Recently there have been some reports from users that when closing the app, it remains in the taskbar and can only be terminated using Task Manager. I have occasionally seen this myself and have also seen an instance where it wasn't in the taskbar but the process was still running, but I haven't found any specific action that causes it. This has only been happening for the last few months so I assume it has something to do with a recent code change, but I don't know exactly what causes this and have no id...

Delphi X5 Android App Deployment
Ive started an new app as firemonkey mobile add a button to it selected the device on the android device list, ran the program and it deploys app to android but is a white blank screen with no button. Something isnt right ? Error or i have to do anything else ? > {quote:title=Jeff Overcash (TeamB) wrote:}{quote} > Sérgio Francisco wrote: > > Ive started an new app as firemonkey mobile add a button to it selected the device on the android device list, ran the program and it deploys app to android but is a white blank screen with no button. Something isnt right ? Error or i ...

Delphi app not always closing properly
I am the developer of a widely distributed application written in Delphi 5. Recently there have been some reports from users that when closing the app, it remains in the taskbar and can only be terminated using Task Manager. I have occasionally seen this myself and have also seen an instance where it wasn't in the taskbar but the process was still running, but I haven't found any specific action that causes it. This has only been happening for the last few months so I assume it has something to do with a recent code change, but I don't know exactly what causes this and have ...

Pop-up on Mobile apps (FireMonkey / Delphi )
Hi everyone, I'm currently working on a FireMonkey mobile app with Delphi (XE6) and since i'm really new to this i'm in need of a little bit of help. For my App i'd like to build in a subscription screen that would work like a pop-up, showing modal on the same form than the login. I've been looking around a bit on the internet but couldn't find any usefull advice. I found a video ("FireMonkey: Showing Modal form with animation and Shadow effect" from Yaroslav Brovin) thad proved me that it was possible, but was unable to find how. I'm sure it'...

Android App Support in Delphi ETA?
Hi -- I have read that the latest release of Delphi supports building iOS applications and that support for Linux and Android were "coming soon" and I wondered if anyone had an ETA of the ability to create Android apps? I would like to leverage my knowledge of Pascal as opposed to learning PHP to create Android apps. Thanks Rich Richard Morey wrote: > I have read that the latest release of Delphi supports building iOS > applications and that support for Linux and Android were "coming > soon" and I wondered if anyone had an ETA of the ability to crea...

Suitable Android phone for Delphi App
I work with small farmers in Africa and Asia, designing data-systems used by the companies which buy their products (coffee, vanilla, nuts etc.) Farm-inspection is a key role. Inspectors visit with lots of paper-forms and questionnaires which are filled in. Some of my users have already migrated to Windows tablets for data collection. But Windows tablets are rare and costly. I have written a couple of Android Apps. Not too big, but they will do useful "small jobs" for the inspectors. However few inspectors yet own smart phones. My client-businesses will have to buy them. ...

App closing or window closing
Is there some function that can be called or a property available at the application level to determine if the application is closing versus a window closing? I have several windows that receive broadcasts when a window closes. When the application is telling the windows to close I would like them to disregard the broadcast. Or a window is told to close by the application versus user it does not broadcast Thanks in advance for any help you can give me on this Marci ...

Web resources about - How to close Android App ?? - embarcadero.delphi.firemonkey

Android Apps - Appolicious ™ App Directory
... You'll Love in association with Trending: games photography photo editing keyboards Join Sign In with Yahoo! Already a member? Log in Android ...

Android phone name generator
Just click on the logo. ∞ Read this on The Loop

Android version history - Wikipedia, the free encyclopedia
Global Android version distribution since December 2009. As of January 2014, Android 4.x Jelly Bean is the most widely used Android version, ...

There is now a free Space Defender-esque game for Android Wear
In the past, we've seen developers get Game Boy Advance games working on Android Wear watches. It's not entirely practical for a number of reasons, ...

Halfbrick’s Star Skater Races Onto iOS, Android
Halfbrick has launched its newest game, Star Skater, on iOS and Android. Created in collaboration with Shawn McInerney of MooseMouse , the level-based ...

Apple’s rumored display shift could push even more Android vendors to switch to OLED
... LCD to OLED screens in future iPhones, suggesting that Apple’s efforts will also have a welcome side effect. Other smartphones, including Android ...

Google Spruces Up Android Wear With New Designer Faces
... statement should be able to find something they like out of the new designs. If not, there are loads of other free watch faces for Android, ...

Android power! 2015's top tips, tricks, and buying advice
What?! Another year, almost over? How is that even possible ? I don't know where the time goes, but I do know this: 2015 has been an absolute ...

Don’t Miss These Android Stories: December 18, 2015
... Droid Life Show. Oh, we also shared more and more last minute holiday deals, many of which you can find below in our list of the best Android ...

Evernote's Skitch will soon bid Android, iOS and Windows farewell
If Skitch is one of your favorite sketching and annotation apps, we hope you're using a Mac, because it's saying goodbye to Android, iOS and ...

Resources last updated: 12/21/2015 5:35:43 AM