Android Question Smb / Workbook Error for 4.1.2

Tayfur

Well-Known Member
Licensed User
Longtime User
Hello

1.
I download xls file with samba code:
B4X:
SMB1.DownloadFile("smb://" & GD_server_ip & Dosya_yolu ,Dosya_adi, File.DirRootExternal,bellek_dosya_adi) '**** çalışıyor

2.
After Open excel files . code is:

Note: Dosya_gorevi=1
B4X:
Sub dosya_ac(Dosya_gorevi As Int,  bellek_dosya_adi As String) ' OPEN FILE
    '--------------------------------------------
    If Dosya_gorevi=0 Then
        ProgressDialogHide
        Msgbox("tanımlanamayan doysa açıldı:"& bellek_dosya_adi,"Dikkat hata !")
    End If
    '--------------------------------------------
    If Dosya_gorevi=1 Then' xls dosyası açılıdı ve combo box firma isimleri yüklenir
        'LoadTable(File.DirRootExternal,"book.xls")

        ProgressDialogHide
        ProgressDialogShow("Veri tabanı listeleniyor...")
        Dim workbook1 As ReadableWorkbook
        'Dim moviesSheet As ReadableSheet
        '*********this line added for only cheking************
        'SMB1.ListFiles(File.DirRootExternal,"book.xls")
       '****************************************
  
        workbook1.Initialize(File.DirRootExternal,"book.xls") '***** PROBLEM LINE
        moviesSheet = workbook1.GetSheet(0)
        ' movisheet e sayfa yüklendi
        Spinner1.Enabled=True
        Spinner1.Clear
        For row = 2 To moviesSheet.RowsCount - 1
            If Spinner1.IndexOf(moviesSheet.GetCellValue(0, row))<0 AND (moviesSheet.GetCellValue(0, row).Trim<>"")  Then
                    Spinner1.Add(moviesSheet.GetCellValue(0, row))
                Else
                    '---------------
                End If
        Next
        Button3.Enabled=True' arama tuşu açıldı
        ProgressDialogHide
    End If


this code work with android 4.0.3,
But, New tablet is Android 4.1.2. and
this code broken at line
B4X:
        workbook1.Initialize(File.DirRootExternal,"book.xls") '***** PROBLEM LINE


3.
after I added lines for cheking.
B4X:
SMB1.ListFiles(File.DirRootExternal,"book.xls")

This is sub for chechk
B4X:
Sub SMB1_ListCompleted(Url As String, Success As Boolean, Entries() As SMBFile)
  If Not(Success) Then
      Log(LastException)
      Dim x =(LastException)
      x=x
      ToastMessageShow(LastException,True)
    
  Else
    
      For i = 0 To Entries.Length - 1
        Log("*****************")
        Log(Entries(i).Name)
        Log(Entries(i).Directory)
        Log(DateTime.Date(Entries(i).LastModified))
        Log(Entries(i).Parent)
        Log(Entries(i).Size)
        'If  Entries(i).Name.StartsWith("Par")=True Then
        If  Entries(i).Name.StartsWith(GD_parca_dosyaadi)=True Then
            'SMB1.DownloadFile("smb://192.168.1.222/DEPO/",Entries(i).Name, File.DirRootExternal,"book.xls") '**** çalışıyor
            SMB1.DownloadFile("smb://"& GD_server_ip& GD_parca_dosyaayolu,Entries(i).Name, File.DirRootExternal,"book.xls") '**** çalışıyor
            End If
        Next
  End If

End Sub


Finally log

Please see EROR.jpg.
and AVD detail.
(my code works wit andoid 4.0.3)
 

Attachments

  • AVD detail.jpg
    AVD detail.jpg
    56.4 KB · Views: 196
  • ERROR.jpg
    ERROR.jpg
    232.5 KB · Views: 220

Tayfur

Well-Known Member
Licensed User
Longtime User
The error is not related to the workbook at all. It fails to download the file.

Check the values you pass to SMB.DownloadFile.
I also recommend you to test it with a real device instead of the emulator.

i try real divece.
Sometimes it is work some times dont work.
I dont understandt.

I push download button.
After ı am waiting long time. Some time download complate. Some time is << download complate events>> " Success" is "False."

I dont understand, code has only problem up 4.0.3 versions.
 
Upvote 0

Tayfur

Well-Known Member
Licensed User
Longtime User
It seems like a network issue. You can try to download the file again if it failed.

Hi Erel.


I tried alot of things. and I focused wifi connection problems on tablet
I searched on web.
I loaded "Wifi Fixer 1.0.2.1".
Now, it runing Wifi fixer. And My code is run. I didnt change my code. it s not broke!!!!

That is stupid, But my code is work.

thak you for helps...
 
Upvote 0
Top