seskindell Active Member Licensed User Longtime User Aug 2, 2018 #1 Any help would be appreciated. Using Samsung S5.
BillMeyer Well-Known Member Licensed User Longtime User Aug 2, 2018 #2 This should do the trick: Code: Copy Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim vib As PhoneVibrate Dim but1 As button End Sub Sub but1_Click vib.vibrate 'do here what you need to with this button End Sub (Untested - Out of my head coding) Enjoy !! Upvote 0
This should do the trick: Code: Copy Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Dim vib As PhoneVibrate Dim but1 As button End Sub Sub but1_Click vib.vibrate 'do here what you need to with this button End Sub (Untested - Out of my head coding) Enjoy !!
Erel B4X founder Staff member Licensed User Longtime User Aug 5, 2018 #3 Source: https://www.b4x.com/android/forum/t...g-a-cross-platform-tetris-game.94212/#content B4A and B4i code: Code: Copy Private Sub PerformHapticFeedback (view As Object) #if B4A Dim jo As JavaObject = view jo.RunMethod("performHapticFeedback", Array(1)) #Else if B4i FeedbackGenerator.RunMethod("impactOccurred", Null) 'see the tetris example #end if End Sub Upvote 0
Source: https://www.b4x.com/android/forum/t...g-a-cross-platform-tetris-game.94212/#content B4A and B4i code: Code: Copy Private Sub PerformHapticFeedback (view As Object) #if B4A Dim jo As JavaObject = view jo.RunMethod("performHapticFeedback", Array(1)) #Else if B4i FeedbackGenerator.RunMethod("impactOccurred", Null) 'see the tetris example #end if End Sub
Paulo Rosa Member Licensed User Sep 3, 2018 #4 Erel said: Source: https://www.b4x.com/android/forum/t...g-a-cross-platform-tetris-game.94212/#content B4A and B4i code: Code: Copy Private Sub PerformHapticFeedback (view As Object) #if B4A Dim jo As JavaObject = view jo.RunMethod("performHapticFeedback", Array(1)) #Else if B4i FeedbackGenerator.RunMethod("impactOccurred", Null) 'see the tetris example #end if End Sub Click to expand... Hi Erel, How can I use this code if the view is a widget image, for instance? I mean, I would like to perform haptic feedback when an image of a widget is pressed. Regards, Upvote 0
Erel said: Source: https://www.b4x.com/android/forum/t...g-a-cross-platform-tetris-game.94212/#content B4A and B4i code: Code: Copy Private Sub PerformHapticFeedback (view As Object) #if B4A Dim jo As JavaObject = view jo.RunMethod("performHapticFeedback", Array(1)) #Else if B4i FeedbackGenerator.RunMethod("impactOccurred", Null) 'see the tetris example #end if End Sub Click to expand... Hi Erel, How can I use this code if the view is a widget image, for instance? I mean, I would like to perform haptic feedback when an image of a widget is pressed. Regards,
Erel B4X founder Staff member Licensed User Longtime User Sep 4, 2018 #5 It is not possible to call it from a service. You can use PhoneVibrate from the Phone library to achieve a similar effect. Upvote 0
It is not possible to call it from a service. You can use PhoneVibrate from the Phone library to achieve a similar effect.
Paulo Rosa Member Licensed User Sep 4, 2018 #6 Erel said: It is not possible to call it from a service. You can use PhoneVibrate from the Phone library to achieve a similar effect. Click to expand... Thank you. Upvote 0
Erel said: It is not possible to call it from a service. You can use PhoneVibrate from the Phone library to achieve a similar effect. Click to expand... Thank you.