Hi guys,
I created a login form with something like these
On Layout Login, there is a panel, name PnlLogin, with will be removed upon successful username and password
Codes for Activity_Resume
And here is the ReDrawMainLayout codes
Here is the codes for menu item click
On Jellybean 4.2.2, app runs ok, but not with ICS.
On ICS, after start other activity, for ex, Sales, when user pressed Back Key, activity return to Main activity, Sub Activity_resume called (MsgBox Resume shows up), but Sub ReDrawMainLayout in that sub never called (MsgBox didn't show), so I got just a blank screen.
This is not the case with JB, Sub Activity_resume called and also Sub ReDrawMainLayout called.
Why is the result is different in ICS vs Jellybean?
Is there a way so that my codes work on all Android ver? Or how to better design login form?
Thanks in advance.
I created a login form with something like these
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
Activity.LoadLayout("login")
End If
End Sub
On Layout Login, there is a panel, name PnlLogin, with will be removed upon successful username and password
B4X:
Sub LoginBtn_Click
PnlLogin.RemoveView
LoginOk = True
ReDrawMainLayout
End Sub
Codes for Activity_Resume
B4X:
Sub Activity_Resume
Msgbox("Resume","")
If(LoginOk = True) Then
Msgbox("1","")
ReDrawMainLayout
End If
End Sub
And here is the ReDrawMainLayout codes
B4X:
Sub ReDrawMainLayout
Activity.LoadLayout("main")
ac2.Initialize("AC", ac2.VERTICAL)
IsAcInitialized = True
For i = 1 To 3
Dim ai As AHActionItem
Dim bd As BitmapDrawable
Dim Filename, Text As String
Select i
Case 1
Filename = "Sales.png"
Text = "Sales"
Case 2
Filename = "Browse.png"
Text = "Browse"
Case 3
Filename = "Report.png"
Text = "Reports"
End Select
bd.Initialize(LoadBitmap(File.DirAssets, Filename))
ai.Initialize(i, Text, bd)
ai.Selected = False
ac2.addActionItem(ai)
Next
End Sub
Here is the codes for menu item click
B4X:
Sub AC_Click (Position As Int, ActionItemID As Int)
Dim Action As AHActionItem
Action = ac2.getActionItem(Position)
If(Action.Title = "Sales") Then
StartActivity(Sales)
Else If(Action.Title = "Report") Then
StartActivity(Reports)
Else If(Action.Title = "Browse") Then
StartActivity(Browse)
Else
ToastMessageShow(Action.Title & " pressed", False)
End If
End Sub
On Jellybean 4.2.2, app runs ok, but not with ICS.
On ICS, after start other activity, for ex, Sales, when user pressed Back Key, activity return to Main activity, Sub Activity_resume called (MsgBox Resume shows up), but Sub ReDrawMainLayout in that sub never called (MsgBox didn't show), so I got just a blank screen.
This is not the case with JB, Sub Activity_resume called and also Sub ReDrawMainLayout called.
Why is the result is different in ICS vs Jellybean?
Is there a way so that my codes work on all Android ver? Or how to better design login form?
Thanks in advance.