Android Question Delay and Blank screen after calling CallSubDelayed connecting 2 activities

shank_devdroid

Member
Licensed User
Longtime User
Dear Members,

Please help I am switching from a LogIn screen(Main Activity) to a 2nd activity having a lot of panels,layout and images.
As soon as I call the CallSubDelayed Method fter successful Login details there is a delay and a blank screen appears, after a delay of about 4-5 seconds the 2nd activity is created and the respective screen appears.

Please find the code below and screenshots of the same.

B4X:
If enteredPassword = masterPassword Then
                Log("login successful")
                Msgbox("Login Successful", "HURRAY!!!")
                resetAllPassword
                CallSubDelayed(Automation, "Activity_Create")               
'                StartActivity(Automation)
                               
            Else
                Log("Wrong password!!")
                Msgbox("Wrong Password!! Please enter again!", "OOPSS!!")

Also I tried using StartActivity too but this also gives the same problem.

The code for another activity-Automation
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Room_Change")
   
   
    Activity.LoadLayout("Main")
    Socket1.Initialize("Socket1")
    Socket1.Connect("192.168.1.125",8081,2000)
    pnlHome.LoadLayout("Home")
    pnlLighting.LoadLayout("Lighting")
    pnlTempControl.LoadLayout("Temperature_Control")
    pnlEntertainment.LoadLayout("Entertainment")
    pnlTelevision.LoadLayout("Television")
    pnlSTB.LoadLayout("STB")
    pnlSecurity.LoadLayout("Security")
    pnlDVD.LoadLayout("DVD")
    pnlChnlList.LoadLayout("chnllist")
    pnlSurveillance.LoadLayout("Surveillance")
    pnlSecurity_Control.LoadLayout("Security_Control")
    pnlProjector.LoadLayout("Projector")
   
    pnlChnlList.LoadLayout("ChnlList")
    pnlEngEnt.LoadLayout("EngEnt")
    pnlEngNews.LoadLayout("EngNews")
    pnlEngMovies.LoadLayout("EngMovies")
    pnlHinEnt.LoadLayout("HinEnt")
    pnlHinNews.LoadLayout("HinNews")
    pnlHinMovies.LoadLayout("HinMovies")
    pnlHD.LoadLayout("HD")
    pnlDoordarshan.LoadLayout("Doordarshan")
    pnlKannada.LoadLayout("Kanada")
    pnlKids.LoadLayout("Kids")
    pnlKnowledge.LoadLayout("Knowledge")
    pnlMalayalam.LoadLayout("Malyalam")
    pnlMarathi.LoadLayout("Marathi")
    pnlMusic.LoadLayout("Music")
    pnlActive.LoadLayout("Active")
    pnlPunjabi.LoadLayout("Punjabi")
    pnlOryBen.LoadLayout("OryBen")
    pnlSports.LoadLayout("Sports")
    pnlTamil.LoadLayout("Tamil")
    pnlTelugu.LoadLayout("Telugu")
   
   
    pnlMain.Visible=True   
    ImageView2.Visible=True
    pnlHome.Visible=False
    pnlLighting.Visible=False
    pnlTempControl.Visible=False
    pnlSTB.Visible=False
    pnlEntertainment.Visible=False
    pnlTelevision.Visible=False
    pnlSecurity.Visible=False
    pnlDVD.Visible=False
    pnlChnlList.Visible=False
    pnlSurveillance.Visible=False
    pnlSecurity_Control.Visible=False
    pnlProjector.Visible=False
   
    pnlChnlList.Visible = False
    pnlEngEnt.Visible = False
    pnlEngNews.Visible = False
    pnlEngMovies.Visible = False
    pnlHinEnt.Visible = False
    pnlHinNews.Visible = False
    pnlHinMovies.Visible = False
    pnlDoordarshan.Visible = False
    pnlKannada.Visible = False
    pnlKids.Visible = False
    pnlKnowledge.Visible = False
    pnlHD.Visible = False
    pnlMalayalam.Visible = False
    pnlMarathi.Visible = False
    pnlMusic.Visible = False
    pnlActive.Visible = False
    pnlPunjabi.Visible = False
    pnlOryBen.Visible = False
    pnlSports.Visible = False
    pnlTamil.Visible = False
    pnlTelugu.Visible = False
End Sub

Let me know if you need more information on the same.
Thanks & Regards.
 

shank_devdroid

Member
Licensed User
Longtime User
Thanks for the reply Erel.

Yes I have tested in the release mode and there is 4-5 sec delay when switching to the 2nd Activity.

I will move the socket initialization in the Started service and check again!
Do you think any other issue/problem can be the reason for this delay?

Regards!
 
Upvote 0

shank_devdroid

Member
Licensed User
Longtime User
Thank you so much Erel for this information,

Well I will check and load the other layouts in the respective subs.
Only the main layout will be called during Activity_Create Sub.

If I come across any issue, I will post it here.

Really Thanks
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…