What else (no coffee!)

LucaMs

Expert
Licensed User
Longtime User
why are you posting an issue/question in the chit chat forum?
I'm writing here, Chit Chat, because I know that nobody could help me without the projects (B4A & B4J). So this is just to say...

AAAAAAARRRRRRRGGGGGGGHHHHH
but, given that I received many technical suggetions (thanks all), I had to respond adequately.


your post #15 is very unclear since you dont use the code view when you post a code.
Sorry, I don't understand what you mean with "code view".



can you upload a small project where the issue can be reproduced?
No, because it cannot be small, at least because even the server's messages could be the problem (although, just in #15, it is seen that the ws_TextMessage routine, which receives messages from the server, is not executed.
 

LucaMs

Expert
Licensed User
Longtime User

Cableguy

Expert
Licensed User
Longtime User
B4X:
[actGameRoom] the Activity "automatically" restarted
[clsPlayer] a Class
[cvPlayer] a custom View
[srvComm] a Service
[WSHandler] a websocket handler class


[actGameRoom] code...Private Sub btnExit_Click
code...Dim Answ As Int
code...Dim txt As String
code...txt = "Exit from room: are you sure?"
code...If mStatus = STATUS_PLAYING Then
code...txt = txt & CRLF & CRLF & "IF YOU EXIT NOW, YOU WILL PAY xxx"
code...End If
code...Answ = Msgbox2(txt, "ATTENTION", "Yes", "", "No", Null)
code...If Answ = DialogResponse.POSITIVE Then
code...RemovePlayer(mMyTurnOrder)
[actGameRoom] code...Private Sub RemovePlayer(TurnOrder As Int)
code...Dim Player As clsPlayer = mmapPlayers.Get(TurnOrder)
code...mPlaces(Player.PlaceIndex).GetLabelTop.Text = "Vacancy"
[clsPlayer] code...Public Sub getPlaceIndex As Int
code...Return mPlaceIndex
[cvPlayer] code...Public Sub GetLabelTop As Label
code...Return mlblTop
code...mPlaces(Player.PlaceIndex).Photo = mDefaultPhoto
[clsPlayer] code...Public Sub getPlaceIndex As Int
code...Return mPlaceIndex
[cvPlayer] code...Public Sub setPhoto(Photo As Bitmap)
code...mPhoto = Photo
code...mivPhoto.Color = mPhotoColor
code...FitCenterBitmap(mivPhoto, Photo)
[cvPlayer] code...Private Sub FitCenterBitmap(Imv As ImageView, bmp As Bitmap)
code...Private cvs As Canvas
code...cvs.Initialize(Imv)
code...Dim rectDest As Rect
code...Dim delta As Int
code...If bmp.Width / bmp.Height > Imv.Width / Imv.Height Then
code...delta = (Imv.Width - bmp.Width / bmp.Height * Imv.Height) / 2
code...rectDest.Initialize(delta, 0, Imv.Width - delta, Imv.Height)
code...End If
code...SetAntiAlias(cvs, FILTER_BITMAP_FLAG) ' non cambia alcunché, in questo caso!
[cvPlayer] code...Private Sub SetAntiAlias (c As Canvas, FilterFlag As Int)
code...Dim r As Reflector
code...Dim NativeCanvas As Object
code...r.Target = c
code...NativeCanvas = r.GetField("canvas")
code...Dim PaintFlagsDrawFilter As Object
code...PaintFlagsDrawFilter = r.CreateObject2("android.graphics.PaintFlagsDrawFilter",Array As Object(0, FilterFlag), Array As String("java.lang.int", "java.lang.int"))
code...r.Target = NativeCanvas
code...r.RunMethod4("setDrawFilter", Array As Object(PaintFlagsDrawFilter), Array As String("android.graphics.DrawFilter"))
code...cvs.DrawBitmap(bmp, Null, rectDest)
code...Imv.Gravity = Gravity.FILL
code...Imv.Invalidate
code...Player = Null
code...mMyTurnOrder = -1
code...CallSubDelayed2(srvComm, "RunOnServerPlayerExitsGameRoom", True)
code...LogColor("Chiudo actGameRoom", Colors.Red)
Chiudo actGameRoom <---
code...Activity.Finish
code...End If
[srvComm] code...Private Sub RunOnServerPlayerExitsGameRoom(Voluntary As Boolean)
code...Dim Data As Map : Data.Initialize
code...Data.Put("Voluntary", Voluntary)
code...wsh.SendEventToServer("PlayerExitsGameRoom", Data)
[WSHandler] code...Public Sub SendEventToServer(Event As String, Data As Map)
code...Dim m As Map
code...m.Initialize
code...m.Put("type", "event")
code...m.Put("event", "FromClient_" & Event)
code...m.Put("params", Data)
code...Dim jg As JSONGenerator
code...jg.Initialize(m)
code...ws.SendText(jg.ToString)
** Activity (actgameroom) Pause, UserClosed = true **
[actGameRoom] code...Sub Activity_Pause (UserClosed As Boolean)
code...ActivityIsStarted = Not(UserClosed)
** Activity (actgameroom) Create, isFirst = false **
[actGameRoom] code...Sub Activity_Create(FirstTime As Boolean)
code...Activity.LoadLayout("layGameRoom")
 
D

Deleted member 103

Guest
How can I do this? The Activity restarts just after its closing.
What value the variable "FirstTime" has after close and re-start?
B4X:
Sub Activity_Create(FirstTime As Boolean)
 
D

Deleted member 103

Guest
From what activity this activity is usually started?
Perhaps here is the problem ?
 
Top