Android在所有代码中使用Toast,包括非UI线程
来源:互联网 发布:vue.js prop 编辑:程序博客网 时间:2024/06/07 03:15
<application android:name="base.Global" android:allowBackup="true" android:hardwareAccelerated="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:persistent="true" android:theme="@style/AppTheme" >.............</application>
package base;import android.app.Application;import android.content.Context;import android.os.Handler;import android.os.Message;import android.widget.Toast;import core.CCore;public class Global extends Application {public static Context context = null;public static Handler handler = null;// public CCore cr = // public static Activity mainActivity = null;public static CCore cr = null;// public static DeviceFragment deviceFragment = null;@Overridepublic void onCreate() {context = getApplicationContext();handler = new Handler_Global();super.onCreate();}private static class Handler_Global extends Handler {@Overridepublic void dispatchMessage(Message msg) {switch (msg.what) {case 0:Toast.makeText(context, (String)msg.obj, Toast.LENGTH_SHORT).show();break;default:break;}super.dispatchMessage(msg);}}}
0 0
- Android在所有代码中使用Toast,包括非UI线程
- 在非UI线程中使用Toast
- Android在非UI线程中显示Toast
- Android在非UI线程中显示Toast
- Android在非UI线程中显示Toast
- Android在非UI线程中显示Toast
- Android在非UI线程中显示Toast
- Android在非UI线程中显示Toast
- Android在非UI线程中显示Toast
- Android在非UI线程中显示Toast
- 在非UI线程中显示Toast
- 非UI线程中Toast
- IntentService(或非UI线程)中使用Toast
- android非UI线程调用Toast
- 非UI线程中显示Toast
- Android Activity的setTitle,AlertDialog,Toast操作是否都必须在非主UI线程中操作呢?
- Android在非UI线程中更新UI的方法
- Android开之在非UI线程中更新UI
- 34. Search for a Range
- Json与javaBean之间的转换工具类
- (转)Android Studio快捷键大全 和 Eclipse对照
- yii form 表单提交之前JS在提交按钮的验证
- RxBus
- Android在所有代码中使用Toast,包括非UI线程
- mini ui form.setData()设置不上值
- Josephus Problem (约瑟夫环数学解法)
- (转)Android Studio 与 Eclipse 快捷键对照及AS常用快捷键
- 计算器
- java集合框架(一)Collection
- 链表实现逆置
- Opencv 图像边缘拉伸
- To be g beast programmer