Android Question [SOLVED] Calling an activity by tapping on a widget

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

Can you tell me what coding I need to add to the widget service in order to call an activity when the user taps the widget?

Thanks.
 

Pendrush

Well-Known Member
Licensed User
Longtime User
For example (if panel name is Panel1):
B4X:
Sub Panel1_Click
    StartActivity(Main) 'Main is name of activity you want to start, add name of your activity
End Sub
add this code in widget service.
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
For example (if panel name is Panel1):
B4X:
Sub Panel1_Click
    StartActivity(Main) 'Main is name of activity you want to start, add name of your activity
End Sub
add this code in widget service.

Hi Pendrush,

I tried to right click in the designer to declare a Dim for the panel but instead got a message telling me "Current module does not support adding members". Looks like with widgets there must be a different way to do it.
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
Hi Everyone,

It turns out you I didn't need to declare a Dim for the panel. Just using the panel name like Pendrush stated was all I needed to do.

Here's the code that worked:

B4X:
Sub MyPanel_Click
    StartActivity(Main)
End Sub
 
Upvote 0
Top