Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: Going to home (launcher) screen


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


Permlink Replies: 2 - Last Post: Aug 23, 2016 1:09 PM Last Post By: ray white
ray white

Posts: 7
Registered: 8/16/98
Going to home (launcher) screen  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 12, 2016 1:15 PM
Hi there I want the app to go to sleep (not terminate) and bring up the home screen. (I am reprogramming the back button) It seems like there ought to be a simple delphi command for that but couldn't find anything.

I found this info on stack overflow but am not too up on android or Java so I was wondering could somebody translate this to Delphi fmx or maybe let me know about a command I couldn't find.

Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_HOME);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Going to home (launcher) screen  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 12, 2016 4:09 PM   in response to: ray white in response to: ray white
ray white

Posts: 7
Registered: 8/16/98
Re: Going to home (launcher) screen  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Aug 23, 2016 1:09 PM   in response to: Eli M in response to: Eli M
Hi there This is a good example of how to handle the back key but it closes the app rather than just going back to the home launcher. I did manage to translate the code though here it is.

procedure gohome;
var
Intent: JIntent; //Declares the intent object
begin
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_MAIN); //Defines the Action.
Intent.addcategory(TJIntent.JavaClass.CATEGORY_HOME);
MainActivity.startActivity(Intent); //Calls startActivity() to send the intent to the system.
end;


Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02