自学android 碰到的知识点总结
来源:互联网 发布:趣头条刷金币软件 编辑:程序博客网 时间:2024/06/02 06:25
获取当前系统版本等级
Buidl.VERSION.SDK_INT
获取当前系统内存容量
File path = Enviroment.getExternalStorageDirectory();
StatFs stat = new StatFs(path.getPath());
blockSize = stat.getBlockSizeLong();
totalBlocks = stat.getBlockCountLong();
availableBlocks = stat.getAvailablesBocksLong();
//在Manifest.xml 中配置测试框架
<instrumentation
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.itheima.day03_sqlite"
></instrumentation>
<uses-library android:name="android.test.runner"/>
## 常用快捷键 ##
- ctrl + shift + o 导包
- ctrl + shift + t 快速查找某个类
- 先按ctrl + 2 ,再点L, 创建变量并命名
- ctrl + o , 在当前类中,快速查找某个方法
- ctrl + k, 向下查找某个字符串
- ctrl + shift + k, 向上查找某个字符串
- alt + 左方向键 跳转上一个页面
-ctrl+shift+f, 代码格式化
禁用事件三连发:
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
常用第三方:
xutils 来下载网络资源
TextUtils
android.text.TextUtils的类,主要的功能如下:
是否为空字符 boolean
android.text.TextUtils.
isEmpty(CharSequence str)
拼接字符串 String android.text.TextUtils.join(CharSequence delimiter, Object[] tokens)
拆分字符串 String[]
android.text.TextUtils.
split(String text, String expression)
拆分字符串使用正则 String[]
android.text.TextUtils.
split(String text, Pattern pattern)
确定大小写是否有效在当前位置的文本 int
android.text.TextUtils.
getCapsMode(CharSequence cs, int off, int reqModes)
使用HTML编码这个字符串
String android.text.TextUtils.
htmlEncode(String s)
另外,
String[]
中的expression较特殊,如果采用android.text.TextUtils.
split(String text, String expression)
TextUtils来分割someString的话返回的将是错误结果,正确的用法应该是
TextUtilssplit
<span style="background-color: rgb(240, 240, 240); font-family: Arial, Helvetica, sans-serif;">监听打电话使用receiver, 监听接电话使用TelephonyManager tm = getSystemService(TELEPHONY_SERVICE);</span>
adapter.notifyDataSetChanged() //刷新页面
</pre><pre class="default prettyprint prettyprinted" name="code" style="white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">类似 (int flags) 对int flags 的 api描述是Additional option flags. 所有类似描述 我们都可以直接在android中传0就可以了
</pre><pre class="default prettyprint prettyprinted" name="code" style="white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">子线程不能刷新UI, 如果我们只是想弹出一个toast,可以通过一下来实现
</pre>public class ToastUtils {<span style="white-space:pre"></span>public static void showToast(final Activity context, final String msg){<span style="white-space:pre"></span>if("main".equals(Thread.currentThread().getName())){<span style="white-space:pre"></span>Toast.makeText(context, msg, Toast.LENGTH_LONG).show();<span style="white-space:pre"></span>}else{<span style="white-space:pre"></span>context.runOnUiThread(new Runnable() {<span style="white-space:pre"></span><span style="white-space:pre"></span>@Override<span style="white-space:pre"></span>public void run() {<span style="white-space:pre"></span>Toast.makeText(context, msg, 1).show();<span style="white-space:pre"></span><span style="white-space:pre"></span>}<span style="white-space:pre"></span>});<span style="white-space:pre"></span>}<span style="white-space:pre"></span>}<p>}</p><p></p><p>活动管理器 (任务管理器) 所有进程数据可以通过activitymanager 获取</p><p>AcitivityManager activityManager = (ActivityManager)getSystemService(ACTIVITY_SERVICE);</p><p>包管理器 :</p><p>PackageManager packageManager = getPackageManager();</p><pre class="default prettyprint prettyprinted" name="code" style="white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 26px; background-color: rgb(255, 255, 255);">
- 自学android 碰到的知识点总结
- 自学android 碰到的知识点总结 (第二版)
- Oracle碰到的小知识点
- 做题碰到的知识点
- android的面试知识点总结
- 黑马程序员------Android自学的一点总结
- Android 通过httpclient 调用碰到的问题总结
- Android 通过httpclient 调用碰到的问题总结
- Android 通过httpclient 调用碰到的问题总结
- android开发中碰到的问题总结(保持更新)
- Android Studio 开发中碰到的问题总结
- android自学总结
- 【转】android自学总结
- android自学总结1
- android自学总结3
- 9月碰到的几个问题和知识点
- 更新CocoaPods碰到的问题及知识点
- Kotlin学习中触碰到的知识点
- [HW] OJ记录20题之三
- Unity-遇到的坑汇总
- java面试题集锦
- 最小生成树算法Prim、Kruskal
- 支付宝分布式事务文章
- 自学android 碰到的知识点总结
- map 用法。
- 网络游戏服务器端架构设计
- 验证码
- Linux下面的终端编程 做一个简单的菜单
- 解决重新安装MySQL无法 start service的问题
- html5
- YARN工作流程
- 数字转换成字符串进行连接