Handler and Thread
来源:互联网 发布:matlab 2013b for mac 编辑:程序博客网 时间:2024/05/18 21:50
package gt.gt;
import gt.gt.util.FetchData;
import gt.gt.util.PreferencesUtil;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.widget.TextView;
public class ShowInfo extends Activity implements Runnable {
private static final String TAG = "ShowInfo";
TextView info;
TextView title;
private ProgressDialog pd;
public String info_datas;
public boolean is_valid = false;
public int _id = 0;
public String _name = "";
public int _position;
public int _ref = 0;
@Override
public void run() {
switch (_id) {
case PreferencesUtil.CPU_INFO:
info_datas = FetchData.fetch_cpu_info();
break;
case PreferencesUtil.DISK_INFO:
info_datas = FetchData.fetch_disk_info();
break;
case PreferencesUtil.NET_STATUS:
info_datas = FetchData.fetch_netstat_info();
break;
case PreferencesUtil.VER_INFO:
info_datas = FetchData.fetch_version_info();
break;
case PreferencesUtil.DMESG_INFO:
info_datas = FetchData.fetch_dmesg_info();
break;
case PreferencesUtil.RunningProcesses:
info_datas = FetchData.fetch_process_info();
break;
case PreferencesUtil.NET_CONFIG:
info_datas = FetchData.fetch_netcfg_info();
break;
case PreferencesUtil.MOUNT_INFO:
info_datas = FetchData.fetch_mount_info();
break;
case PreferencesUtil.TEL_STATUS:
info_datas = FetchData.fetch_tel_status(this);
break;
case PreferencesUtil.MEM_INFO:
info_datas = FetchData.getMemoryInfo(this);
break;
case PreferencesUtil.SystemProperty:
info_datas = FetchData.getSystemProperty();
break;
case PreferencesUtil.DisplayMetrics:
info_datas = FetchData.getDisplayMetrics(this);
break;
case PreferencesUtil.RunningService:
info_datas = FetchData.getRunningServicesInfo(this);
break;
case PreferencesUtil.RunningTasks:
info_datas = FetchData.getRunningTasksInfo(this);
break;
}
handler.sendEmptyMessage(0);
}
private Handler handler=new Handler(){
public void handleMessage(Message msg)
{
pd.dismiss();
info.setText(info_datas);
}
};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.showinfo);
revParams();
info = (TextView) findViewById(R.id.info);
title = (TextView) findViewById(R.id.title);
setTitle("eoeInfosAssistant" + _name);
title.setText(_name);
load_data();
}
private void load_data() {
pd = ProgressDialog.show(this, "please wait a moment",
"fetch info datas...", true, false);
Thread thread = new Thread(this);
thread.start();
}
private void revParams() {
Intent startingIntent = getIntent();
if (startingIntent != null) {
Bundle infod = startingIntent.getBundleExtra("android.info");
if (infod == null) {
is_valid = false;
}
else
{_id=infod.getInt("id");
_name=infod.getString("name");
_position=infod.getInt("position");
is_valid=true;
}
}
else {
is_valid=false;
}
Log.i(TAG,_name+" "+_id);
}
}
- Handler and Thread
- Handler and Thread
- thread loop and handler
- Android Thread and Handler
- android handler, thread and looper
- Android Dev Intro - Thread Looper and Handler
- Handler + Thread
- handler thread
- Handler Thread
- Android 后台任务(二)Thread And Handler
- Handler Thread Looper
- Android Thread 与 Handler
- Handler Thread looper
- AsyncTask VS Thread+Handler
- Android: thread & handler
- android Thread/Handler 实现
- android thread handler timertask
- handler thread 使用 2
- xp自动登录
- GDAL源码剖析(五)之Python命令行程序
- .net学习前奏----.Net应该学什么怎么学(三)?
- 最小割专辑
- 父窗口与弹出窗口之间的传值问题?
- Handler and Thread
- .net学习前奏----.Net应该学什么怎么学(四)?
- Handler and Thread
- 关于几点问题的几点小思考
- GDAL源码剖析(六)之GDAL开发及其调试
- Job的任务执行流程之TaskCleanup
- 心里有点空,写点东西鼓励一下自己
- 信息资源管理 第三章
- 3168 Sort ZOJ7