android学习日志六
学习一定有方法,有经验,有动力,有悟性,还要总结。
(一)
想在eclipse下导入一个android工程,这个工程已经存在了,总是提示invalid project description。其实是方法错了,这是解决问题的方法:
I have struggled with this issue myself for a while and I think the reason it happens is because (for Android) there are two ways to import projects into the workspace
1) import>General>Existing Project into Workspace
2) import>Android>Existing Code into Workspace
The errors described here are related to method 2).
For method 1) there will be no overlap problems as long as you uncheck the "Copy Projects into Workspace" box if the project is already in the workspace.
(二)
http://docs.since2006.com/android/2.1-drawables.php 使用android系统下的图标资源@android:drawable/editbox_background(editbox_background是安卓操作系统的图片)
(三)
Adding imports solved the problem for me.
And I found out that actually in Eclipse they can be imported automatically:
"Tip: After you have pasted sample code into an Eclipse project, press Ctrl (or Cmd) + Shift + O to import the required packages"
Hope this refresh what have been missed.
其实在用eclipse编写代码的时候,缺省的包可以通过按ctrl+shift+O导入。
(四)
byte[ ] 转换为 string
String str = new String(bytes, "UTF-8");
如果系统默认file.encoding.system是utf-8的可以省略后面的参数,直接写成
String str = new String(bytes);
也可以如下:
String str = IOUtils.toString(inputStream, "UTF-8");
这样呢: byte[] byteArray = new byte[] {87, 79, 87, 46, 46, 46}; String value = new String(byteArray, "UTF-8");
更多相关文章
- 浅谈Java中Collections.sort对List排序的两种方法
- Python list sort方法的具体使用
- python list.sort()根据多个关键字排序的方法实现
- Android退出程序的多种方法
- 编程回忆之Android回忆(Android的强制横屏,竖屏,长亮)
- JS判断终端类型的几种方法
- android 使用Intent传递对象 Serializable 或者 Parcelabel 《第
- 关于新版SDK报错You need to use a Theme.AppCompat theme的两种
- Android非UI线程访问UI线程的方法总结