i'm trying open xlsx file within android app.
i'm aware intent type have fire application/excel, despite i've installed google sheets, code says no application can open excel file.
this code use fire intent:
private void openxls(){ file xls = new file(environment.getexternalstoragepublicdirectory(environment.directory_documents), "prova.xlsx"); uri path = uri.fromfile(xls); intent intent = new intent(intent.action_view); intent.setdataandtype(path, "application/excel"); intent.setflags(intent.flag_activity_new_task); try { context.startactivity(intent); } catch (activitynotfoundexception e) { toast.maketext(context, "no application available view xls", toast.length_short).show(); } } note: prova.xlsx exists, , i'm able reach , open it.
solved
using mime type application/vnd.ms-excel, *.xls , *.xlsx files can opened.
Comments
Post a Comment