android - Using Intents to Launch another app to open a .vtk file -
i working on app in android, , in app, user can browse , select .vtk file.
i have installed app called "kiwiviewer," opens these .vtk files. when manually go through tablet, , click on .vtk files using file managing app, kiwiviewer opens these .vtk files no problem.
i have same thing occur in app. user's selected .vtk file opened kiwiviewer. know kiwiviewer's package ("com.kitware.kiwiviewer"), , able open app intent. however, unable open .vtk file passed app.
intent = new intent(this.getpackagemanager().getlaunchintentforpackage("com.kitware.kiwiviewer")); i.setdata(uri.parse(getintent().getextras().getstring("imageuri"))); startactivity(i);
i have checked, , data being sent valid (it isn't null, , right file.
i have tried following, doesn't work either:
intent = new intent(); i.setdata(uri.parse(getintent().getextras().getstring("imageuri"))); i.setpackage("com.kitware.kiwiviewer"); startactivity(i);
however, "activity not found exception."
how can launch kiwiviewer opens data provide it?
edit: seems when @ uri path being supplied kiwiviewer, /document/primary:experimentdata/mhdimage.vtk. kiwiviewer says not exist. in reality, path /sdcard/experimentdata/mhdimage.vtk. reason why 2 differ?
turns out, after looking @ source code kiwiviewer, needs uri scheme of file, not content, open data. in addition, had manually extract subdirectories ("experimentdata/mhdimage.vtk") , concatenate "/sdcard/" kiwiviewer open data. know hardcoding frowned upon, when use alternate "/sdcard/" (environment.getexternalstoragedirectory().getpath()), not correct directory.