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

rleiman

Well-Known Member
Licensed 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
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.
 

rleiman

Well-Known Member
Licensed 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.
 

rleiman

Well-Known Member
Licensed 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
 
Top