MCPcopy Create free account
hub / github.com/GcsSloop/SUtil / show

Method show

library/src/main/java/com/sloop/utils/ToastUtils.java:24–36  ·  view source on GitHub ↗

@param context Context @param string 内容

(final Activity context, final String string)

Source from the content-addressed store, hash-verified

22 * @param string 内容
23 */
24 public static void show(final Activity context, final String string) {
25 //判断是否为主线程
26 if ("main".equals(Thread.currentThread().getName())) {
27 Toast.makeText(context, string, Toast.LENGTH_SHORT).show();
28 } else {//如果不是,就用该方法使其在ui线程中运行
29 context.runOnUiThread(new Runnable() {
30 @Override
31 public void run() {
32 Toast.makeText(context, string, Toast.LENGTH_SHORT).show();
33 }
34 });
35 }
36 }
37}

Callers 1

runMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected