Android Question Libraries

Don Roberts

Member
Licensed User
Hi,
I've noticed that as I have added more libraries to my project the "startup screen" with the cog
shows for an extended period of time (Attached Image).
I am not sure if this window is Android Version specific or if B4a creates it or what.

I am wondering it seems like this is when the libraries are loading.
Is there any way to track or show the progress? as opposed to this Blank Black screen.


Thanks

Don
 

Attachments

  • Screenshot_2016-01-08-16-52-33.png
    Screenshot_2016-01-08-16-52-33.png
    19.6 KB · Views: 225

Don Roberts

Member
Licensed User
Erel,
Thank You for the quick reply.

I have a lot of lines going on in the activity create.
That was my first thought, so I entered into debug and set to pause on the first line.
That window with the cog is up for 15-18 secs then my activity with my icon shows then
like 1 sec for it to pause on line one.
I clicked to play the rest and the create took less than 2 secs to run all lines and the app to be active.

It is a lot of lines pre-filling spinners mostly.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tested your app. Activity_Create is called very quickly. The problem is with the huge layout file.

You have created many "screens" in the same layout files. This is not the correct way to build the layout. You should instead create multiple layout files and then load the layout needed each time (if it was not already loaded).
 
Upvote 0

Don Roberts

Member
Licensed User
I've tested your app. Activity_Create is called very quickly. The problem is with the huge layout file.

You have created many "screens" in the same layout files. This is not the correct way to build the layout. You should instead create multiple layout files and then load the layout needed each time (if it was not already loaded).

Aaaah Ok. Thanks very much for taking the time to have a look.
I will Adjust accordingly.
 
Upvote 0

Don Roberts

Member
Licensed User
Erel,
just wanted to touch base with you again. The program has no issue with the .bal file size.
I removed all and I was still over 15 seconds so I returned to original and started removing
items 1 at a time in the activity create.
Turns out I had forgotten that the MFG table was so huge (almost 2600 records).
The lag it turns out was in the loop all records to add MFG (if not exist already) to the spinner.

B4X:
'Get MFGNames to spinner
    SQL1.Initialize(DBFilePath, DBFilename, False)
    Cursor1 = SQL1.ExecQuery("SELECT MFG FROM BC2015 order by MFG Asc")
    'Get last calculation values
    If Cursor1.RowCount<>0 Then
        For i = 0 To Cursor1.RowCount - 1
            Cursor1.Position=i
            MFGNAME=Cursor1.GetString("MFG") 'first item to spinner
                If MFGNAMESAVED="" Then
                    Spinner1.add(MFGNAME)
                    MFGNAMESAVED=MFGNAME
                End If
            If MFGNAMESAVED<>"" Then 'all other items
                If MFGNAME<>MFGNAMESAVED Then   
                    Spinner1.Add (MFGNAME)
                    MFGNAMESAVED=MFGNAME
                End If       
            End If
        Next
    End If
    Cursor1.Close
    Catch
        Msgbox(LastException,"ERROR")
       
    End Try

I am now back to a 4 sec load, trying to figure out how to speed that operation up.
 
Upvote 0

Don Roberts

Member
Licensed User
Erel,
I had mistakenly REM the line fs.init for the fileshare lib with the build MFG list...
This was the culprit. This lib takes like 10 secs to initialize.
So I moved that 1 line to the button to pull up the shares folder and loading problem
is solved.
Couldn't time the MFG build it was too fast... So no issue there either.
 
Upvote 0
Top