#### index.html代码 ~~~ function share(shareTip, shareText) { var Context = plus.android.importClass("android.content.Intent"); var Main = plus.android.runtimeMainActivity(); var shareIntent = new Context(Context.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Context.EXTRA_TEXT, shareText); Main.startActivity(Context.createChooser(shareIntent, shareTip)); } //调用 share('分享到...', '要分享的文本'); ~~~ #### 运行截图 ![](https://box.kancloud.cn/5249fb43890d19b41ae9b1074e0d7938_584x552.jpg) #### 完整代码 ~~~ <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <script> // 扩展API是否准备好,如果没有则监听“plusready"事件 if(window.plus) { plusReady(); } else { document.addEventListener("plusready", plusReady, false); } // 扩展API准备完成后要执行的操作 function plusReady() { function share(shareTip, shareText) { var Context = plus.android.importClass("android.content.Intent"); var Main = plus.android.runtimeMainActivity(); var shareIntent = new Context(Context.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(Context.EXTRA_TEXT, shareText); Main.startActivity(Context.createChooser(shareIntent, shareTip)); } //调用 share('分享到...', '要分享的文本'); } </script> </head> <body> </body> </html> ~~~