Android Question How to select an option in an AlertDialog with intent

Alex Guerrero

Member
Licensed User
Hello everyone, lately when I want to share a file I get an alertdialog 'want to share with...' with two options, 'Cancel' and 'Ok', in some cases I require 'Cancel' and in others 'Ok', I don't want the user to choose it, therefore I want to handle it with an intent, I have tried several unsuccessful ways, I appreciate your help.

Hola a todos, últimamente cuando deseo compartir un archivo me aparece un mensaje de alerta 'Desea compartir con...' con dos opciones, 'Cancel' y 'Ok', en algunos casos requiero 'Cancel' y en otros 'Ok', no quiero que el usuario lo escoja, por tanto quiero manejarlo con un intent, he intentado de varias maneras sin éxito, les agradezco su ayuda.

b4a:
Dim TipoEvento As String
Dim Evento As JavaObject = Event
Dim paquete As String = Evento.RunMethod("getPackageName", Array As Object()) 
TipoEvento = Evento.RunMethod("getEventType", Array As Object())
Log("TipoEvento: "& TipoEvento)
      
For Each item As String In mylist
    If success = False Then
        '******************************
      
        'here I need to intercept the alertdialog to choose an option
        acs.PerformGlobalAction(AccServConstants.ACTION_CLICK) 'it does not work
      
        '******************************
        acs.delay(2000) '2500
        success = acs.PerformNodeActionOnViewWithArgs(True, "com.agrotc",AccServConstants.ACTION_CLICK, Null)
    Else if success = True And lastbackout = False Then
        acs.delay(1500)
        acs.PerformGlobalAction(AccServConstants.GLOBAL_ACTION_BACK)
        acs.delay(1500)
    End If
  
Next
Sin nombre2.jpg
 
Last edited:
Top