2013年3月7日
摘要: 很好的文档,随时可能都要用到,特转贴过来!1、字符串String转化为整数int int i = Integer.parseInt(str); int i = Integer.valueOf(my_str).intValue(); 注: 字串转成Double, Float, Long的方法大同小异。 2、将字符串String转化为Integer Integer integer=Integer.valueOf(i) 3、将整数 int 转换成字串 String? 有三种方法: String s = String.valueOf(i); String s = Integer.to... 阅读全文
posted @ 2013-03-07 16:31 wzc0066 阅读(317) 评论(0) 推荐(0) 编辑
摘要: 比如通过文档查看器打开一个文本文件时,会弹出一个可用来打开的软件列表;如何让自己的软件也出现在该列表中呢? 通过设置AndroidManifest.xml文件即可: <activity android:name=".EasyNote" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="portrait"> <intent-filter> <action 阅读全文
posted @ 2013-03-07 16:30 wzc0066 阅读(379) 评论(0) 推荐(0) 编辑
摘要: 关于ImageView的相关设置://设置背景颜色ImageView.setBackgroundColor(android.graphics.Color.parseColor("#f30a0a"));ImageView.setBackgroundColor(Color.RED);ImageView.setBackgroundColor(Color.rgb(255, 0, 0));//通过Resource方式设置背景图片ImageView.setImageResource(R.drawable.bg);//通过字符串拼接方式动态设置图片String imgname = &qu 阅读全文
posted @ 2013-03-07 16:29 wzc0066 阅读(368) 评论(0) 推荐(0) 编辑
摘要: 因为需要安装一个便携AP功能的软件,所以需要先获取ROOT权限!ROOTing方法参见:tosh-ac100.wetpaint.com/page/Rooting1: Instal z4root.- Link to z4root page. (forum.xda-developers.com/showthread.php?t=833953)- Download the APK file and instal it on youre AC100.2: The usb debugging mode must be turn on.- Settings> applications > de 阅读全文
posted @ 2013-03-07 16:28 wzc0066 阅读(303) 评论(0) 推荐(0) 编辑
摘要: main.xml文件:<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android 阅读全文
posted @ 2013-03-07 16:25 wzc0066 阅读(229) 评论(0) 推荐(0) 编辑
摘要: 算法:顺序遍历,每次生成一个随机位置,和当前位置的元素互换。运行时间是线性的,测试程序如下:import java.util.Random;public class Test{ public static void main(String args[]) { int[] arr = new int[10]; arr = getSequence(10); for(int i=0; i<10; i++){ System.out.println(arr[i]); } } private static in... 阅读全文
posted @ 2013-03-07 16:24 wzc0066 阅读(469) 评论(0) 推荐(0) 编辑
摘要: 其实就一句,不过前面需要先获取bitmap对象。 Resources res=getResources(); BitmapDrawable bmpDraw=(BitmapDrawable)res.getDrawable(R.id.abc); Bitmap bmp=bmpDraw.getBitmap(); try{ setWallpaper(bmp); }catch(IOException e) { e.printStackTrace(); }至于如何设置待机壁纸,... 阅读全文
posted @ 2013-03-07 16:23 wzc0066 阅读(805) 评论(0) 推荐(0) 编辑
摘要: 比如要判断当前ImageView里面的图片是否为R.id.abc这个图片,可以通过如下方式判定:if(imageView.getDrawable().getConstantState().equals(getResources().getDrawable(R.id.abc).getConstantState())) System.out.println("true");else System.out.println("false"); 阅读全文
posted @ 2013-03-07 16:07 wzc0066 阅读(351) 评论(0) 推荐(0) 编辑
摘要: Android UI 中提供invalidate()来更新界面,而invalidate()方法是非线程安全,所以需要借助handler实现。main.xml:<?xml version="1.0" encoding="utf-8"?><ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/sv2" android:layout_width="fill_parent&qu 阅读全文
posted @ 2013-03-07 16:06 wzc0066 阅读(1053) 评论(0) 推荐(0) 编辑
摘要: Android系统本身的很多应用都是具有滑动效果的,当用手上划或下划操作时,到达应用的边界后还会出现一段缓冲,显得很自然,同时滚动的速度也比较快!如果联系人列表,短信列表,还有很多配置画面都有这个属性。通过ListView肯定是可以实现滑动效果的,但实现起来比较复杂;通过ScrollView却能很简单实现这一效果:比如有个TextView,里面有很多内容;如果再其外面再套上一层<ScrollView>,浏览内容时就很方便了,可快速的定位到内容的尾部。注意,<ScrollView>的直接子元素只能有一个,但子元素可以包含自己的子元素的。还有就是默认<ScrollVi 阅读全文
posted @ 2013-03-07 16:05 wzc0066 阅读(634) 评论(0) 推荐(0) 编辑