Android Question Problem with intent CLOSE_SYSTEM_DIALOGS

Linostar

Member
Licensed User
Longtime User
Hi,

I am trying to disable recent apps dialog (usually open by long-pressing the home key) using the the following code:

Code: Copy
Sub Activity_WindowFocusChanged(Focused As Boolean)
   dim myPhone as Phone
   If Not(Focused) Then
     Dim i As Intent
     i.Initialize("android.intent.action.CLOSE_SYSTEM_DIALOGS", "")
     myPhone.SendBroadcastIntent(i)
   End If
End Sub

However, this is giving me a java.lang.NullPointerException error when the window loses focus.
Where is the error I've committed?

Thanks.
 
Can you post the full error message from the logs?

Sorry. It seems the nsip I posted above was bit different from my actual code. The declaration of "myPhone as Phone" in my actual code was made in the Globals sub. When I moved it to the Activity_WindowFocusHasChanged sub, there is no longer a jaba.lang.NullPointerException error occuring, which I find pretty weird by the way.

Now, although the error disappeared, the sendBoradcastIntent command isn't doing what it is supposed to do here, and I can still open the recent apps dialog by long pressing the home key.

Any suggestions?
 
Upvote 0
Back
Top