java中showinfo怎么打出来_showinfo.java

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);}};}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1.定义一个人的类(属性有名字,年龄,性别。写一个能输出各个属性值的方法showInfo()),定义一个学生类(属性有学号),学生继承人类,要求: (1)父类的属性赋值用构造方法来实现(分别用有参数构造方法和无参数构造方法实现); (2)子类的属性也用构造方法来赋值; (3)在子类重写父类的showInfo()方法 (4)声明学生类的对象,调用学生的显示信息的方法。 2、请编码实现动物世界的继承关系: 动物(Animal)具有行为:吃(eat)、睡觉(sleep)、移动(move) 动物包括:兔子(Rabbit),老虎(Tiger),鹰(eagle) 这些动物吃、移动的行为各不相同(eat,move动作不同);但睡觉的行为是一致的。 3、(1)设计一个表示二维平面上点的类Point,包含有表示坐标位置的protected类型的,成员变量x和y,获取和设置x和y值的public方法。 (2)设计一个表示二维平面上圆的类Circle,它继承自类Point,还包含有表示圆半径的protected类型的成员变量r、获取和设置r值的public方法、计算圆面积的public方法。 (3)设计一个表示圆柱体的类Cylinder,它继承自类Circle,还包含有表示圆柱体高的protected类型的成员变量h、获取和设置h值的public方法、计算圆柱体体积的public方法。 (4)建立Cylinder对象,输出其轴心位置坐标、半径、面积、高及其体积的值。
### 回答1: showinfo方法是自定义的方法,具体使用方法需要看该方法的实现。一般来说,调用showinfo方法需要先创建一个对象,然后通过该对象调用showinfo方法。例如: ``` public class MyClass { public void showinfo() { System.out.println("这是一个showinfo方法"); } } public class Main { public static void main(String[] args) { MyClass myObj = new MyClass(); myObj.showinfo(); } } ``` 在上面的例子,我们先创建了一个MyClass类,其定义了一个showinfo方法。在Main类,我们创建了一个MyClass对象myObj,并通过myObj调用了showinfo方法。运行程序后,会输出“这是一个showinfo方法”。 ### 回答2: Java的showInfo方法实际上是一个自定义方法,它可以用来显示一些信息,例如用户输入错误时的提示信息或者执行某些操作后的反馈信息等等。下面我们来看一下如何在Java使用showInfo方法: 1. 在Java定义showInfo方法 在Java定义showInfo方法的方法很简单:在代码写下如下代码: public static void showInfo(String message) { System.out.println(message); } 其,public表示该方法是公共的;static表示该方法属于类而不是对象;void表示该方法不返回任何内容;而String message则是方法的参数,表示传递给showInfo方法的信息内容。 2. 调用showInfo方法 要调用showInfo方法,需要在代码使用类名.方法名(即:类名.方法名(参数))的格式,例如: ClassName.showInfo("Hello World"); 这里,ClassName表示类名,而showInfo("Hello World")表示对showInfo方法的调用,其参数为字符串Hello World。调用该方法后,程序将会在控制台上显示该字符串。 总的来说,Java的showInfo方法非常简单易用,只需要按照上述步骤定义方法并调用即可。当然,在实际开发,需要根据具体需求设计和优化方法,以更好地满足开发者的需求。 ### 回答3: 在Java,showinfo方法是一种常见的方法,用于显示或打印文本信息或变量的值。showinfo方法通常是用户自定义的,其名称和参数可以根据需要自由定义。 使用showinfo方法,首先需要定义一个类,其包含一个方法名为showinfo的公共方法。下面是一个示例代码: ``` public class MyClass { public void showinfo(String str) { System.out.println("The input string is: " + str); } } ``` 在上面的代码,MyClass是一个类名,其定义了一个名为showinfo的公共方法。该方法接受一个名为str的字符串参数,并在控制台上打印出该字符串。 在主程序,可以实例化这个类,并调用其的showinfo方法。示例代码如下: ``` public static void main(String[] args) { MyClass myObj = new MyClass(); myObj.showinfo("Hello World!"); } ``` 在上面的代码,myObj是MyClass类的一个实例化对象,并且通过对象调用showinfo方法,并将参数“Hello World!”传递给该方法。当程序执行时,该方法将在控制台上打印出“The input string is: Hello World!”。 总之,使用Java的showinfo方法,首先要定义一个类,其包含自定义的showinfo方法。然后,可以实例化该类,并调用其的showinfo方法,并将参数传递给该方法。最终,该方法将执行指定的操作,并将结果输出到控制台上。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值