D DT1111 Member Licensed User Longtime User Aug 14, 2017 #1 Hi Erel et. al. Thanks Erel for introducing MsgBoxAsync as it is extremely useful in my case as the msgbox in now non-modal. Is it possible in Android to turn StartActivity() into StartActivityAsync()? This is useful in the case when a timer is running in the main form and user calls another form via StartActivity which results in the counting in the main form stops. My guess is if "StartActivityAsync" is possible, then in that scenario the counting in the main will not be impeded. Unless there is already a novel way to circumvent which I am not aware. Many thanks.
Hi Erel et. al. Thanks Erel for introducing MsgBoxAsync as it is extremely useful in my case as the msgbox in now non-modal. Is it possible in Android to turn StartActivity() into StartActivityAsync()? This is useful in the case when a timer is running in the main form and user calls another form via StartActivity which results in the counting in the main form stops. My guess is if "StartActivityAsync" is possible, then in that scenario the counting in the main will not be impeded. Unless there is already a novel way to circumvent which I am not aware. Many thanks.
DonManfred Expert Licensed User Longtime User Aug 14, 2017 #2 It is not possible. Move your counter to a service. Upvote 0
D DT1111 Member Licensed User Longtime User Aug 14, 2017 #3 Thanks Manfred and that was what I thought too ie moving code to a service. Upvote 0
KMatle Expert Licensed User Longtime User Aug 14, 2017 #4 DT1111 said: Thanks Manfred and that was what I thought too ie moving code to a service. Click to expand... I put any non UI related functions to services. If you need to display something just use f.e. Code: CallSubDelayed2(ActivityName,"MySub",Value) to call a sub in the Activity you need to. So the timer is inside the service. If it "ticks" just call a sub in the Activity you want to display something. Upvote 0
DT1111 said: Thanks Manfred and that was what I thought too ie moving code to a service. Click to expand... I put any non UI related functions to services. If you need to display something just use f.e. Code: CallSubDelayed2(ActivityName,"MySub",Value) to call a sub in the Activity you need to. So the timer is inside the service. If it "ticks" just call a sub in the Activity you want to display something.
Erel B4X founder Staff member Licensed User Longtime User Aug 15, 2017 #5 I'm not exactly sure what you are looking for. As KMatle CallSubDelayed can be useful here. Tutorial: Using CallSubDelayed to interact between activities and services StartActivity is an async method. It sends a message to the internal message queue. The activity is started when the message is processed. Code: StartActivity(Activity2) Log("This message will be printed before Activity2 is started") Upvote 0
I'm not exactly sure what you are looking for. As KMatle CallSubDelayed can be useful here. Tutorial: Using CallSubDelayed to interact between activities and services StartActivity is an async method. It sends a message to the internal message queue. The activity is started when the message is processed. Code: StartActivity(Activity2) Log("This message will be printed before Activity2 is started")
D DT1111 Member Licensed User Longtime User Aug 15, 2017 #6 Thanks KMatle. I have adopted that approach. I am just curious if it is ever possible to achieve what I am after if the codes stay in the main form. Hi Erel I have put together a simple example to demonstrate what I am looking for. I hope it helps. Attachments StartActivity Example.zip StartActivity Example.zip 9.4 KB · Views: 282 StartActivity.apk StartActivity.apk 123 KB · Views: 282 Upvote 0
Thanks KMatle. I have adopted that approach. I am just curious if it is ever possible to achieve what I am after if the codes stay in the main form. Hi Erel I have put together a simple example to demonstrate what I am looking for. I hope it helps.
D DT1111 Member Licensed User Longtime User Aug 15, 2017 #7 Hi The example is to demonstrate the blocking effect of each called item on the functionality on the main timer and not so much of trying to put "counter's value inside the Label1.text of each activity". I was asking if StartActivityAsync is possible so that an activity is not paused when form2 is called - just like MsgboxAsync. Upvote 0
Hi The example is to demonstrate the blocking effect of each called item on the functionality on the main timer and not so much of trying to put "counter's value inside the Label1.text of each activity". I was asking if StartActivityAsync is possible so that an activity is not paused when form2 is called - just like MsgboxAsync.
DonManfred Expert Licensed User Longtime User Aug 15, 2017 #8 It is not possible. Only one activity can run at the same time Upvote 0