error Unable to pause activity

fanfalveto

Active Member
Licensed User
Longtime User
what is this error?
B4X:
java.lang.RuntimeException: Unable to pause activity {aaaa.aaaa/aaaa.aaaa.main}: java.lang.IllegalArgumentException: View not attached to window manager


   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3143)
   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3098)
   at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3076)
   at android.app.ActivityThread.access$800(ActivityThread.java:153)
   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
   at android.os.Handler.dispatchMessage(Handler.java:99)
   at android.os.Looper.loop(Looper.java:137)
   at android.app.ActivityThread.main(ActivityThread.java:5226)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:511)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
   at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.IllegalArgumentException: View not attached to window manager


   at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:383)
   at android.view.WindowManagerGlobal.removeView(WindowManagerGlobal.java:285)
   at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:79)
   at android.app.Dialog.dismissDialog(Dialog.java:323)
   at android.app.Dialog.dismiss(Dialog.java:306)
   at anywheresoftware.b4a.Msgbox.dismissProgressDialog(Msgbox.java:105)
   at anywheresoftware.b4a.Msgbox.dismiss(Msgbox.java:71)
   at aaaa.aaaa.main.onPause(main.java:182)
   at android.app.Activity.performPause(Activity.java:5206)
   at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1226)
   at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3129)
   ... 12 more
can you help me?
thanks
 

fanfalveto

Active Member
Licensed User
Longtime User
the problem is when i click button1,this is then code of Main activity
B4X:
#Region  Project Attributes 
   #ApplicationLabel: B4A Example
   #VersionCode: 1
   #VersionName: 
   'SupportedOrientations possible values: unspecified, landscape or portrait.
   #SupportedOrientations: portrait
   #CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes 
   #FullScreen: False
   #IncludeTitle: True
#End Region

Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
   Dim listan As List
   Dim listap As List
   Dim listaa As List
   


End Sub

Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
Dim md As MessageDigest
Dim ByteCon As ByteConverter
Dim passwordhash() As Byte
Dim Spinner1 As Spinner
   Dim pas As String
   Dim EditText1 As EditText
   Dim Button1 As Button
   Dim posicionnombre As Int
   Dim hc1 As HttpClient
   Dim base As String
   Dim dat As leerdatos
   Dim Button2 As Button
   Dim listann As List
   Dim listapn As List
   Dim listaan As List
   Dim pa As String
   Dim cif As String
   Dim nomusu As String
   End Sub

Sub Activity_Create(FirstTime As Boolean)
   'Do not forget to load the layout file created with the visual designer. For example:
   
   Activity.LoadLayout("entrada")
   Try
      cif=dat.ci
Catch
      StartActivity(tocif)
   End Try

   rellenausuarios
End Sub
 Sub rellenausuarios
 ExecuteRemoteQuery("http://xxx.xxx.xxx/xxx/xx.php?tipo=1&cif="&cif,1)
 End Sub
 
 Sub ExecuteRemoteQuery (Query As String,TaskId As Int)

Dim req As HttpRequest
req.InitializePost2(Query,Query.GetBytes("UTF8"))
hc1.Initialize("hc")
hc1.Execute(req,TaskId)
Log(Query)
 End Sub

Sub hc_ResponseSuccess(Response As HttpResponse,TaskId As Int)
Dim res As String
res=Response.GetAsynchronously("aa",File.OpenOutput(File.DirInternalCache,"aa.txt",False),True,TaskId)
End Sub
Sub  aa_StreamFinish (Success As Boolean,TaskId As Int)
If Success =False Then

Return
Else
listaa.Initialize
   listap.Initialize
   listan.Initialize
   listaan.Initialize
   listapn.Initialize
   listann.Initialize
Dim cadena As String
cadena=File.ReadString(File.DirInternalCache,"aa.txt")
Dim lista() As String
lista=Regex.Split(";",cadena)
'Nombres
For i= 0 To lista.Length -1
   listann.Add(lista(i))
   i=i+2
Next
'Passwords
For i= 1 To lista.Length -1
   listapn.Add(lista(i))
   i=i+2
Next
'admin
For i= 2 To lista.Length -1
   listaan.Add(lista(i))
   i=i+2
Next
listap=listapn
   listan=listann
   listaa=listaan
'   admin.listanombres.Initialize
admin.listanombres=listann
'combo nombres
Spinner1.Clear
For i= 0 To listan.Size -1
   Spinner1.Add(listann.get(i))
Next
If Spinner1.SelectedItem="" Then
StartActivity(admin)
End If
File.Delete(File.DirInternalCache,"aa.txt")
End If
End Sub
Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Spinner1_ItemClick (Position As Int, Value As Object)
   posicionnombre=Position
   nomusu=Value
   File.WriteString(File.DirInternal,"nomusu.txt","Datos" _
   & CRLF &"nomusu: " &nomusu& "fin")
End Sub
Sub Button1_Click
pa=EditText1.Text
   passwordhash = md.GetMessageDigest(EditText1.Text.GetBytes("UTF8"),"MD5")

Dim md5string As String

md5string = ByteCon.HexFromBytes(passwordhash)
Dim tmp As String
Log (tmp)
'Log ("aaaaa  "&md5string)
tmp=listap.Get(posicionnombre)
If md5string.ToLowerCase=tmp.ToLowerCase OR pa =tmp Then
   Dim adm As String
   pas=EditText1.Text
   adm=listaa.Get(posicionnombre)
'   Log(adm)
   If adm="0" Then 
   StartActivity(usuario) 'usuario

   End If
   If adm="1" Then 
   StartActivity(admin)'administrador
'   EditText1.Text=""

   End If
Else
   Msgbox("Password incorrecto","Error")
   
End If
EditText1.Text=""
End Sub
Sub Button2_Click
   StartActivity(tocif)
'   Activity.Finish
End Sub
 
Upvote 0

fanfalveto

Active Member
Licensed User
Longtime User
when i enter as admin a lot of times no problem ,so when i enter as user the first time is ok,but second i see that error.
also when i enter with an user and exit and enter with other user i see the same error
 
Upvote 0

fanfalveto

Active Member
Licensed User
Longtime User
There aren´t progressdialog in this code,but in other activities yes.I don´t know why affected Progressdialog in other activities to Main activity when i do progressdialogshow("xxx") and after progressdialoghide,but now i quit all progressdialog and no problem.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
There aren´t progressdialog in this code,but in other activities yes.I don´t know why affected Progressdialog in other activities to Main activity when i do progressdialogshow("xxx") and after progressdialoghide,but now i quit all progressdialog and no problem.
I dont understand that either :confused:
 
Upvote 0
Top