java中showinfo怎么打出来_showinfo.java

此篇博客介绍了如何在Android应用中创建名为ShowInfo的Activity,通过继承Runnable并实现run方法,从不同模块如CPU、内存、网络状态等获取并显示实时系统信息。使用ProgressDialog增强用户体验,展示了参数解析和数据加载的流程。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

package com.eoemobile.infos_assistant; import com.eoemobile.infos_assistant.util.FetchData;import com.eoemobile.infos_assistant.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 = 0;public int _ref = 0;@Overridepublic 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() {Log.i(TAG, "revParams.");Intent startingIntent = getIntent();if (startingIntent != null) {Bundle infod = startingIntent.getBundleExtra("android.intent.extra.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:" + _name + ",_id="+_id);} @Overridepublic void run() {if (_ref > 0) {try {Thread.sleep(1000);} catch (InterruptedException e) {Log.i("load_data", "e=" + e.toString());}}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);}};}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值