Android Question I lost layout when i be back to app

RobertG ChuriónR

Member
Licensed User
Hi, in activity_create i loadlayout("main") , it functions fine, but when i press Home button and when i want to be back the app, all show in blank, all objects is hidden, if i was playing witch exoplayer a video it sound but not show, please, how can i show again the layout?, thanks.
 

mangojack

Well-Known Member
Licensed User
Show a portion of code where you load the layout..

You are not loading layout in a ... If FirstTime = True clause ? .. this will not help.
 

RobertG ChuriónR

Member
Licensed User
Show a portion of code where you load the layout..

You are not loading layout in a ... If FirstTime = True clause ? .. this will not help.
This is my code:
B4X:
Sub Process_Globals
    Private player1 As SimpleExoPlayer
End Sub

Sub Globals
    Dim P As Phone
    Dim PE As PhoneEvents
    Dim h As HttpJob
    Private SimpleExoPlayerView1 As SimpleExoPlayerView
    Private ListaCanales As CustomListView
    Private ListViewCanalActual As ListView
    Private SpinnerCategorias As Spinner
End Sub


Sub Activity_Create(FirstTime As Boolean)
   
    Activity.LoadLayout("main")
   
    ListaCanales.DefaultTextBackgroundColor = Colors.ARGB(0,0,0,0)
    ListaCanales.DefaultTextColor = Colors.White

    LogColor(P.Manufacturer, Colors.Red)
   
    Dim Label1 As Label
    Label1 = ListViewCanalActual.TwoLinesLayout.Label
    Label1.Typeface = Typeface.CreateNew( Typeface.SERIF, Typeface.STYLE_BOLD_ITALIC)
    Label1.TextSize = 24
    Label1.TextColor = Colors.White
    Label1.Gravity = Gravity.TOP
    Label1.Height = 28dip

    Dim Label2 As Label
    Label2 = ListViewCanalActual.TwoLinesLayout.SecondLabel
    Label2.Typeface = Typeface.CreateNew( Typeface.SERIF, Typeface.STYLE_ITALIC)
    Label2.TextSize = 18
    Label2.TextColor = Colors.White
    Label2.Gravity = Gravity.TOP
    Label2.Height = 24dip

    ListViewCanalActual.FastScrollEnabled = False

    SpinnerCategorias.TextColor = Colors.ARGB(255,0,254,0)
    SpinnerCategorias.DropdownTextColor = Colors.ARGB(255,255, 255, 255)
    SpinnerCategorias.DropdownBackgroundColor = Colors.ARGB(255,47, 79, 78)
   
    If FirstTime Then
        PE.Initialize("PE")
        player1.Initialize("player")
    End If
   
    SimpleExoPlayerView1.UseController = False
    SimpleExoPlayerView1.Player = player1

    h.Initialize("TraerCategorias", Me)
    h.Download2("http://xxxxxxx.xxx/xxxxxxxx.php", Array As String("myactionvar", "myorder"))

End Sub


Sub Activity_Resume
    player1.Play
End Sub


Sub Activity_Pause (UserClosed As Boolean)
    player1.Pause
End Sub
 

RobertG ChuriónR

Member
Licensed User
While there are several mistakes in your code, I don't see any reason for the layout not to display. Can you upload the project?
Hi @Erel, when i run the app for first time it runs find, it functions perfectly, i can select listview item, exoplayerview_click functions excelent, but, when i go to facebook or whatsapp or other app and i wish to be back to my app, the video sounds, i ear the audio but only responses the Touch/Click event of the activity, not my layout that it has exoplayer maximized.
 
Top