toast即时更新文本

### toast.js ```javascript importClass(android.widget.Toast); let toast = (function () { let toast = null; function showText(msg) { var msg = msg.toString(); if (!toast) { toast = Toast.makeText(context, msg, Toast.LENGTH_SHORT); } else { toast.setText(msg); } toast.show(); } return showText; })(); module.exports = toast; ``` ### main.js ```javascript let toast = require("./toast"); for (var i = 0; i < 10; i++) { toast(i); } ``` **## 声明** 部分内容来自网络 本教程仅用于学习, 禁止用于其他用途