Melghost Member Licensed User Longtime User Jul 28, 2015 #1 Hello! I found several similar threads but not exactly the issue I'm having. My apologies if I'm wrong. I'm trying to start an activity from a service. It's easy, and it works fine when the activity is closed. But when the activity is open, and the service starts, the activity closes instead of remaining open. It doesn't happen when the activity I want to open is Main. This is my (simplified) code: Main: Code: Copy Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Layout1") End Sub Sub Button1_Click StartServiceAt(StActSrv,DateTime.Now+10000,False) End Sub Sub Button2_Click StartActivity(StAct2) End Sub The activity I want to open: Code: Copy Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Layout2") End Sub The service: Code: Copy Sub Service_Start (StartingIntent As Intent) StartActivity(Main) End Sub What am I doing wrong? Thank you very much
Hello! I found several similar threads but not exactly the issue I'm having. My apologies if I'm wrong. I'm trying to start an activity from a service. It's easy, and it works fine when the activity is closed. But when the activity is open, and the service starts, the activity closes instead of remaining open. It doesn't happen when the activity I want to open is Main. This is my (simplified) code: Main: Code: Copy Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Layout1") End Sub Sub Button1_Click StartServiceAt(StActSrv,DateTime.Now+10000,False) End Sub Sub Button2_Click StartActivity(StAct2) End Sub The activity I want to open: Code: Copy Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Layout2") End Sub The service: Code: Copy Sub Service_Start (StartingIntent As Intent) StartActivity(Main) End Sub What am I doing wrong? Thank you very much
RandomCoder Well-Known Member Licensed User Longtime User Jul 28, 2015 #2 I'm not sure I understand. The reason being that in the service start you are always requesting the Main Activity to open... Code: Copy Sub Service_Start (StartingIntent As Intent) StartActivity(Main) End Sub Upvote 0
I'm not sure I understand. The reason being that in the service start you are always requesting the Main Activity to open... Code: Copy Sub Service_Start (StartingIntent As Intent) StartActivity(Main) End Sub
Melghost Member Licensed User Longtime User Jul 28, 2015 #3 ¡Sorry! My Service code: Code: Copy Sub Service_Start (StartingIntent As Intent) StartActivity(StAct2) End Sub I've done a lot of tests and I finally posted the wrong one! Upvote 0
¡Sorry! My Service code: Code: Copy Sub Service_Start (StartingIntent As Intent) StartActivity(StAct2) End Sub I've done a lot of tests and I finally posted the wrong one!
Melghost Member Licensed User Longtime User Jul 28, 2015 #4 Please don't waste your time. I've just found the mistake. Thanks, RandomCoder. That was my sample's mistake. My app's mistake was an Activity.Finish into the Activity_Pause. Sorry. Today I was a little distracted. Upvote 0
Please don't waste your time. I've just found the mistake. Thanks, RandomCoder. That was my sample's mistake. My app's mistake was an Activity.Finish into the Activity_Pause. Sorry. Today I was a little distracted.
RandomCoder Well-Known Member Licensed User Longtime User Jul 28, 2015 #5 I was just mid post when I saw your reply. Thanks for the update. Upvote 0