how to open another app in a tabhost / how to open a word doc within a tabhost of android? -
how to open another app in a tabhost / how to open a word doc within a tabhost of android? -
i've been trying create app open multiple activities help of tabhost. 1 of back upwards open word document within app.
i know how open 1 other app, hope open within app rather having need press button homecoming app.
the code utilize open word doc :
file file = new file (environment.getexternalstoragedirectory(),"/mlt/student.doc"); intent intent = new intent(); intent.setaction(android.content.intent.action_view); intent.setdataandtype(uri.fromfile(file), "application/msword"); startactivity(intent);
i tried add together tab using
file file = new file (environment.getexternalstoragedirectory(),"/mlt/student.doc"); intent = new intent(); intent.setaction(android.content.intent.action_view); intent.setdataandtype(uri.fromfile(file), "application/msword"); spec = tabhost.newtabspec("info").setindicator("info", res.getdrawable(r.drawable.ic_tab_info)).setcontent(intent); tabhost.addtab(spec);
but runtime error, main
01-12 13:16:32.945: e/androidruntime(10066): java.lang.securityexception: requesting code com.infraware.polarisoffice (with uid 10053) run in process com.app.mlt (with uid 10128) "
you can pass intent content of specified tab.
but should careful - there can devices, not necessary apps opening doc files, or there can several apps this. way improve utilize intent.createchooser()
method such operations.
android android-tabhost doc
Comments
Post a Comment