Activity.findViewById(int id)表示通过在xml文件中的id属性来查找控件
Finds a view that was identified by the id attribute from the XML that was processed in onCreate
View.findViewById(int id)表示在给定View上查找id为给定id值得控件
Look for a child view with the given id. If this view has the given id, return this view.
/*int resource,也就是resource/layout文件在R文件中对应的ID,这个必须指定。而ViewGroup root则可以是null,null时就只创建一个resource对应的View,不是null时,会将创建的view自动加为root的child*/View inflate(int resource, ViewGroup root)
TextUtils.equals(String str);
Intent intent = new Intent(WatchDogService.this,passWord_Activity.class);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.putExtra("PackName",packName);startActivity(intent);
android:excludeFromRecents="true"
android:launchMode="singleInstance"
//获取手机型号和系统版本号String sdk=android.os.Build.VERSION.SDK; // SDK号String model=android.os.Build.MODEL; // 手机型号String release=android.os.Build.VERSION.RELEASE; // android系统版本号
listView的加载过程,是数据加载完了,才呈现在手机屏幕上,如果想让用户看到加载过程逐条呈现可以使用其他的布局方式
例:拷贝数据库文件:assets->data/data/com.itheima.mobilesafe/files
InputStream is = getAssets().open(dbname); //打开程序包中的资产文件FileOutputStream fos = this.openFileOutput(dbname, Context.MODE_PRIVATE);//对应的路径data/data/com.itheima.mobilesafe/files
//控制prograssBar的进度progressBar1.setMax(packInfos.size());//设置总大小progressBar1.setProgress(progress);//设置当前进度
//设置为不可用点击view.getChildAt(i).setEnabled(false);
viewgroup可以获得父控件上的子控件,但View没有这个能力
原文:http://www.cnblogs.com/candledragle/p/361b3adf4e4bb432e7fccb19573838af.html