Italian come chiamare un intent con dati extra

sirjo66

Well-Known Member
Licensed User
Longtime User
Ciao a tutti,
devo chiamare un intent passandogli dei parametri (dati extra), ed ho trovato questa documentazione:
B4X:
public void XMTVPlayerPlayUri(String Title,String uri){
   Bundle bnd = new Bundle();
   bnd.putString("path", uri);
   bnd.putString("name", Title);
   bnd.putBoolean("HideBufferLine", true); // Hide yellow buffer status line
   Intent intent = new Intent();
   intent.setClassName("com.xmtvplayer.watch.live.streams","org.zeipel.videoplayer.XMTVPlayer");
   intent.putExtras(bnd);
   startActivityForResult(intent, 100);
}

..... ma non so come farlo in B4A

Qualcuno mi aiuta ??
Grazie
Sergio
 

sirjo66

Well-Known Member
Licensed User
Longtime User
ciao e grazie della risposta,
mi spieghi dove posso trovare info su "inline Java" ???

Sergio

Edit: ho trovato che il "inline java" c'è dal B4A 4.30 in poi, io ho il 4.0
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Per iniziare dovrebbe essere un qualcosa di simile:

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private ion As Object
End Sub
 
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
 
End Sub
 
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
   
 
End
 
Sub ion_Event (MethodName As String, Args() As Object) As Object
'Args(0) = resultCode
'Args(1) = intent
Return Null
End Sub
 
Sub StartActivityForResult(i As Intent)
   Dim jo As JavaObject = GetBA
   ion = jo.CreateEvent("com.xmtvplayer.watch.live.streams","org.zeipel.videoplayer.XMTVPlayer", Null)
   jo.RunMethod("startActivityForResult", Array As Object(ion, 100))
End Sub
 
Sub GetBA As Object
   Dim jo As JavaObject
   Dim cls As String = Me
   cls = cls.SubString("class ".Length)
   jo.InitializeStatic(cls)
   Return jo.GetField("processBA")
End Sub
 
Sub XMTVPlayerPlayUri(Title As String, Uri As String)
   Dim returnIntent As Intent
   returnIntent.PutExtra("path",Uri)
   returnIntent.PutExtra("name",Title)
   returnIntent.PutExtra("HideBufferLine","True")
   StartActivityForResult(returnIntent) 'Or StartService(returnIntent)
 
End Sub

Altro metodo che ha suggerito Luca è QUESTO ( se vedi l'esempio e hai la documentazione ti rendi conto che non è una cosa difficile )
 
Top