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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值