Open file from network drive

Stulish

Active Member
Licensed User
Longtime User
Hi all,

i have been playing with the SMB lib and trying to make a basic explorer program (i have attached a zip).

the file now seems to work really well and displays the correct icon depending on file type along with the name of the file also showing file size and date last modified.

The network path is displayed at the top of the screen and to go back use the back button on the phone/tablet.

I have now tried to get the app to open when a file is clicked the code snipped to open the file is below (inside the files_TtemClick subroutine):

B4X:
   Dim i As Intent 
      i.Initialize(i.ACTION_VIEW,Value)
      i.SetType(fileInf.GetFileType(Value))   
      StartActivity(i)

i get the following error:

An error has occured in sub:main_files_itemclick (java line:388)
android.content.ActivityNotFoundException: No Activity found to handle Intent {act=android.intent.action.VIEW dat=smb://networkdrive/2TB Network Drive/DefaultPicture.bmp type=image/x-ms-bmp flg=0x20000 }
continue?

the log can be seen below:

(ArrayList) [[name=2TB Network Drive/, IsInitialized=false, size=0


, date=0, dir=true], [name=IPC$/, IsInitialized=false, size=0
, date=0, dir=true]]
(ArrayList) [[name=$RECYCLE.BIN/, IsInitialized=false, size=0


, date=1341141326000, dir=true], [name=.lifeline/, IsInitialized=false, size=0
, date=1340984144000, dir=true], [name=Audio/, IsInitialized=false, size=0
, date=1310153584000, dir=true], [name=Autorun.inf, IsInitialized=false, size=25
, date=1209996858000, dir=false], [name=DefaultPicture.bmp, IsInitialized=false, size=17154
, date=1305260156000, dir=false], [name=Documents and other/, IsInitialized=false, size=0
, date=1305290174000, dir=true], [name=Downloads/, IsInitialized=false, size=0
, date=1356121555000, dir=true], [name=Icon1.ico, IsInitialized=false, size=44856
, date=1211302482000, dir=false], [name=Video/, IsInitialized=false, size=0
, date=1305290166000, dir=true]]
main_files_itemclick (java line: 388)


android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=smb://networkdrive/2TB Network Drive/DefaultPicture.bmp typ=image/x-ms-bmp flg=0x20000 }


at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1536)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1388)
at android.app.Activity.startActivityForResult(Activity.java:3252)
at android.app.Activity.startActivity(Activity.java:3359)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:670)
at lishsoft.network.media.main._files_itemclick(main.java:388)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
at anywheresoftware.b4a.BA$2.run(BA.java:266)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4517)
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:993)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:760)
at dalvik.system.NativeStart.main(Native Method)
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=smb://networkdrive/2TB Network Drive/DefaultPicture.bmp typ=image/x-ms-bmp flg=0x20000 }


There is also an error when i change orientation or exit the app and then go back in, it says label or listview not initialized, but it always works on the first use. I have tried initializing the views but strange behavior happens depending on where i initialize.

Any advice would be appreciated.
 

Attachments

  • screen_shot.png
    screen_shot.png
    94.6 KB · Views: 537
  • network_explorer.zip
    59.6 KB · Views: 482
Last edited:

alienhunter

Active Member
Licensed User
Longtime User
nice work

thanks for sharing this code, it is working very well .
Linux and windows

I got one question how do i add a file extension so it will be not "Unknown" anymore ?

example : *.nc

it is slipping thru this : " If fType<>"Unknown" Then "

thanks
 
Upvote 0
Top