I have a very strange problem here that is clearly connected with the Android Version (6) and device (BLU Studio XL2), because doesn't happen in Samsung (Android 4), but I really could be more comfortable if could identify and fix because I really don't know if will happen with other combinations of Android and Device... so, let's go:
Imagine that I have two activities: contatos and indicacoes . In contatos I have the code calling indicacoes :
And in contatos also, in Resume:
The code runs without any error...
In indicacoes I have the code calling contatos:
... and in indicacoes RESUME:
In BLU device, sometimes when switching between activity contatos and indicacoes the target automatically pauses... and if I call the app again from launcher the activity is resumed (wasn't closed, was really resumed without any request). The log says:
We can see indicacoes Pause... contatos Resume... and then... Pause??? Why?
It's very strange and I'm afraid that is something that eventually could happen in other devices. I can't imagine how to prevent from happening, as there is no code line calling that activity Pause (and happens only sometimes)... a detail: the automatic pause occurs when touching any point of activity panel. Any!
Suggestions about what could be happening are welcome... the challenge is launched!
Imagine that I have two activities: contatos and indicacoes . In contatos I have the code calling indicacoes :
B4X:
Sub lbl4_Click
StartActivity(indicacoes)
End Sub
And in contatos also, in Resume:
B4X:
Sub Activity_Resume
Dim DatabaseCompleted = Kvs.Get("database_completed")
If DatabaseCompleted = "done" Then
If CargaCompleta Then
ULV.RefreshContent
Else
Sql1.Initialize(File.DirInternal,"clubdata.db",True)
lbl5.Visible = False
Dim Query As String
Dim Cursor1 As Cursor
Query = "select ordem from contacts where sms_sent = 'Y' or sms_sent = 'N' order by name"
Cursor1 = Sql1.ExecQuery(Query)
Dim I As Int
For I = 0 To Cursor1.RowCount - 1
Cursor1.Position = I
ULV.AddItem("ContactItem",Cursor1.GetInt("ordem"))
Next
CargaCompleta = True
CancelScheduledService(sms_batch)
Kvs.Put("smscontatosbatch","ongoing")
StartService(sms_batch)
End If
End If
End Sub
The code runs without any error...
In indicacoes I have the code calling contatos:
B4X:
Sub lbl2_Click
StartActivity(contatos)
End Sub
... and in indicacoes RESUME:
B4X:
Sub Activity_Resume
Dim Query As String
Dim Cursor1 As Cursor
ULV.ClearContent
Query = "select id from indicacoes order by razaosocial asc"
Cursor1 = Sql1.ExecQuery(Query)
If Cursor1.RowCount > 0 Then
lbl5.Visible = False
Dim I As Int
For I = 0 To Cursor1.RowCount - 1
Cursor1.Position = I
ULV.AddItem("IndicacoesItem", Cursor1.GetInt("id"))
Next
End If
End Sub
In BLU device, sometimes when switching between activity contatos and indicacoes the target automatically pauses... and if I call the app again from launcher the activity is resumed (wasn't closed, was really resumed without any request). The log says:
B4X:
Logger connected to: BLU Studio XL 2
--------- beginning of system
--------- beginning of main
** Activity (contatos) Resume **
** Activity (contatos) Pause, UserClosed = false **
** Activity (indicacoes) Resume **
** Activity (indicacoes) Pause, UserClosed = false **
** Activity (indicacoes) Resume **
** Activity (indicacoes) Pause, UserClosed = false **
** Activity (contatos) Resume **
** Activity (contatos) Pause, UserClosed = false **
** Activity (indicacoes) Resume **
** Activity (indicacoes) Pause, UserClosed = false **
** Activity (contatos) Resume **
** Activity (contatos) Pause, UserClosed = false **
We can see indicacoes Pause... contatos Resume... and then... Pause??? Why?
It's very strange and I'm afraid that is something that eventually could happen in other devices. I can't imagine how to prevent from happening, as there is no code line calling that activity Pause (and happens only sometimes)... a detail: the automatic pause occurs when touching any point of activity panel. Any!
Suggestions about what could be happening are welcome... the challenge is launched!