Reference: http://bbs.wps.cn/thread-22327642-1-1.html
The following is a code example that specifies that the document be opened using the WPS Chinese version (WPS differs slightly from the language version of the package, please note the Red Mark section):
< open File >
Call StartActivity Open, as follows: Boolean openFile (String path) { Intent Intent = new Intent (); Bundle bundle = new bundle ();
<span style= "White-space:pre" ></span>//set requirements according to different circumstances
<span style= "White-space:pre" ></span>//the following budle are control scenarios bundle.putstring (Open_mode, READ_ONLY); Bundle.putboolean (Send_close_broad, true); Bundle.putstring (Third_package, selfpackagename); Bundle.putboolean (Clear_buffer, true); Bundle.putboolean (Clear_trace, true); Bundle.putboolean (Clear_file, true); Intent.addflags (Intent.flag_activity_new_task); Intent.setaction (Android.content.Intent.ACTION_VIEW); Intent.setclassname (PackageName, className); File File = new file (path); if (file = = NULL | |!file.exists ()) {return false; } uri uri = uri.fromfile (file); Intent.setdata (URI); Intent.putextras (bundle); try { StartActivity (Intent); } catch (Activitynotfoundexception e) {e.printstacktrace (); return false; } return true; }
where classname is "Cn.wps.moffice.documentmanager.PreStartActivity2", PackageName according to the version: "Cn.wps.moffice_eng" (normal edition)," Cn.wps.moffice_eng "(English version). The file to be opened is passed through the URI, and the other parameters to be passed are described in the following table:
"Save File"When the file is saved, a "Cn.wps.moffice.file.save" broadcast is sent, and the third-party program listens to the broadcast as needed. The broadcast contains the path information of the file, the package name that is passed when the file is opened, and so on, when used as appropriate, as shown in the following table:
"Close File"
when the file is closed, a "cn.wps.moffice.file.close" broadcast is sent, and the third-party program listens to the broadcast as needed. The broadcast contains the path information of the file, the package name that is passed when the file is opened, and so on, when used as appropriate, as shown in the following table:
Support Mode
Close File
Save File
Open File
To provide you with a Demo:Android_WPS.rar
How Android calls WPS to display working files