上一页 1 ··· 3 4 5 6 7
摘要: //webview 的常用设置final WebView webView = (WebView) findViewById(R.id.hot_app); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true);//设置js 可用 webSettings.setSupportZoom(true); webSettings.setBuiltInZoomControls(true);//支持控件缩放 webSet... 阅读全文
posted @ 2012-08-08 08:58 lipeil 阅读(561) 评论(0) 推荐(0) 编辑
摘要: 常用的方法有三种 分别是 sax ,dom , pull;在org 中 org.w3c.dom 、org.w3c.dom.ls、org.xml.sax、org.xml.sax.ext、org.xml.sax.helpers、org.xmlpull.v1、org.xmlpull.v1.sax2 定义了 dom 、sax、pull的接口在javax中 javax.xml.parsers 中定义了 dom 和 sax 的 解析接口 和工厂 (DocumentBuilder 、 SAXParser 和 DocumentBuilderFactory、SAXParserFactory)在 android. 阅读全文
posted @ 2012-08-06 14:04 lipeil 阅读(676) 评论(0) 推荐(0) 编辑
摘要: 1、直接再ui线程中初始化,这种情况handlermessage会在 ui线程中执行2、传入Looper 参数,这种情况会在ht线程中执行 handlermessage。HandlerThread ht = new HandlerThread("handler");ht.start();Handler handler = new Handler(ht.getLooper());步骤分析:1、HandlerThread 继承Thread public void run() { mTid = Process.myTid(); Looper.prepare(); ... 阅读全文
posted @ 2012-07-31 16:09 lipeil 阅读(672) 评论(0) 推荐(0) 编辑
摘要: 第一步:定义Activity 继承 PreferenceActivity使用addPreferencesFromResource(R.xml.preferences); 显示 xml第二步:编写preferences xml文件保存再 res/xml目录下<?xml version="1.0" encoding="utf-8"?><PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" > <CheckBoxP 阅读全文
posted @ 2012-07-30 11:25 lipeil 阅读(3220) 评论(0) 推荐(0) 编辑
摘要: 1、wifilockAndroid 对WiFi电源管理的代码主要在WifiService.java中。如果应用程序想在屏幕被关掉后继续使用WiFi则可以调用 acquireWifiLock来锁住WiFi,该操作会阻止WiFi进入睡眠状态。当应用程序不再使用WiFi时需要调用 releaseWifiLock来释放WiFi。之后WiFi可以进入睡眠状态以节省电源。默认情况下当屏幕被关掉以后,如果没有应用程序在使用WiFi,WiFi会在2分钟后进入睡眠状态。这主要是为防止频繁地改变WiFi的电源模式。private void takeWifiLock() { myLog.d("T... 阅读全文
posted @ 2012-07-30 11:09 lipeil 阅读(7149) 评论(0) 推荐(0) 编辑
摘要: 1、interrupt 方法可以用来 中断 线程的阻塞状态(例如: thread.interupt() 将会改变 线程thread的阻塞状态)2、join 阻塞当前线程3、退出循环线程一般可以用变量标记。 阅读全文
posted @ 2012-07-30 10:44 lipeil 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 源码地址:http://ppareit.github.com/swiftp/ git clone git://github.com/ppareit/swiftp1、获取手机的wifi 地址作为 ftp 服务器的地址public static InetAddress getWifiIp() { Context myContext = Globals.getContext(); if (myContext == null) { throw new NullPointerException("Global context is n... 阅读全文
posted @ 2012-07-28 14:34 lipeil 阅读(2442) 评论(0) 推荐(0) 编辑
摘要: 1、tar 解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)2、.gz解压1:gunzip FileName.gz解压2:gzip -d FileName.gz压缩:gzip FileName3、.tar.gz 和 .tgz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileName.tar.gz DirName4、.zip解压:unzip FileName.zip压缩:zip FileName.zip DirName5、.rar解压:rar x FileName.ra 阅读全文
posted @ 2012-07-25 15:51 lipeil 阅读(494) 评论(0) 推荐(0) 编辑
摘要: 1、再androidmanifest.xml 中设置activity属性 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"//去掉状态栏及标题栏2、再code中设置: 在setContentView前面加入:requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏 getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_F 阅读全文
posted @ 2012-07-25 15:45 lipeil 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 1、使用Geocoder 来转换经纬度与街道地址,不过经常获取不到2、使用链接http://ditu.google.cn/maps/geo?output=csv&key=abcdef&q= 从网络获取 其中output标记返回的格式,可以为 csv(用‘,’分开)、json、xml key 可以任意字符串 q值如果为街道地址,则返回经纬度;如果为经纬度(用‘,’分开),则返回街道地址3、使用 mController.animateTo(mGeoPoint);可以定位到某一个经纬度。4、使用以下代码段可以再地图上添加图层MyLocationOverlay myLocationOv 阅读全文
posted @ 2012-07-24 09:58 lipeil 阅读(653) 评论(0) 推荐(0) 编辑
摘要: 除了使用oauth认证然后调用各大平台的接口分享外还有一种简单的方法可以实现分享功能。缺点是需要用户手机上已经安装了那些客户端 Intent intent=new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); //纯文本 /*图片分享 it.setType("image/png"); //添加图片 File f = new File(Environment.getExternalStorageDirectory() +"/Pictures/2.png"); U... 阅读全文
posted @ 2012-07-20 14:56 lipeil 阅读(224) 评论(0) 推荐(0) 编辑
摘要: 1、cd .android/2、keytool -list -keystore debug.keystore 阅读全文
posted @ 2012-07-19 11:39 lipeil 阅读(841) 评论(0) 推荐(0) 编辑
摘要: 1、强引用平时所使用的最普遍的引用,不是用额外修饰符修饰,例如 Object obj = new Object() 就是强引用。特点:如果我们不手动 将obj = null;垃圾回收器绝不会回收它。当内存空间不足, JVM宁愿抛出OutOfMemoryError错误,使程序异常终止,也不会靠随意回收具有强引用的对象来解决内存不足问题。2、软引用(SofeReference)使用修饰符SofeReference 修饰引用对象,例如 int[] a = new int[10000000]; int[]> array = new SoftReference<int[]>(a); a 阅读全文
posted @ 2012-07-19 09:28 lipeil 阅读(267) 评论(0) 推荐(0) 编辑
摘要: /** * A方法追加文件:使用RandomAccessFile * @param fileName 文件名 * @param content 追加的内容 */public static void appendA(String fileName, String content){ try { // 打开一个随机访问文件流,按读写方式 RandomAccessFile randomFile = new RandomAccessFile(fileName, "rw"); // 文件长度,字节数 long fileLength = rando... 阅读全文
posted @ 2012-07-18 17:22 lipeil 阅读(2607) 评论(0) 推荐(0) 编辑
摘要: 1、转换文件内容编码Windows下生成的纯文本文件,其中文编码为GBK,在Ubuntu下显示为乱码,可以使用iconv命令进行转换:iconv -f gbk -t utf8 source_file > target_file参考文章:http://www.cnblogs.com/end/archive/2011/04/19/2021507.html 阅读全文
posted @ 2012-07-18 17:15 lipeil 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 第一步:配置ratingbar 的style<style name="foodRatingBar" parent="@android:style/Widget.RatingBar"> <item name="android:progressDrawable">@drawable/food_ratingbar_full</item> <item name="android:minHeight">48dip</item> <item name=" 阅读全文
posted @ 2012-07-13 16:22 lipeil 阅读(5161) 评论(0) 推荐(0) 编辑
摘要: 本次1、sqlite 只有5种本地类型(integer ,real , text , blob , null);2、创建表的几种不同的配置: a、CREATE TABLE my_table (id integer primary key , firstname text , lastname text , age integer); b、CREATE TABLE my_table (id integer primary key , firstname text NOT NULL,lastname text NOT NULL , age integer); 如果设置了NOT NULL 参数,则再 阅读全文
posted @ 2012-07-10 19:34 lipeil 阅读(351) 评论(0) 推荐(0) 编辑
摘要: 所有的例子都是再ubuntu环境下,测试。1、使用命令 sqlite3 test.db 进入sqlite3 模式。2、.headers on 查询时显示字段名,经常与 .mode column合用 用于改善显示格式。3、create table test (id integer primary key , value text); 创建表 test ,注意凡是 sql语句 需要以‘;’结束。4、.table 命令显示 当前数据库中的所有表。5、.schema [table name] 可以得到 表或视图的定义(DDL)语句。6、.indices table_name 显示一个表的索引。7、.d 阅读全文
posted @ 2012-07-09 15:13 lipeil 阅读(262) 评论(0) 推荐(0) 编辑
摘要: struct 占用的内存大小:struct{char a;short b;int c;char d;}//占用12字节struct{char a;char b;short c;int d;}//占用 8 个字节struct{char a:1;char b:1;}//占用1个字节struct{char a:1;int b:1;}//占用4个字节涉及到的概念:内存对齐(提升寻址效率)、 阅读全文
posted @ 2012-07-08 21:42 lipeil 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 1、下载安装文件路径:http://www.google.cn/chrome/eula.html?hl=zh-CN&platform=linux_ubuntu_i3862、安装命令:sudo dpkg -i google-chrome-stable_amd64.deb3、如果报错(缺少依赖关系)sudo apt-get -f install4、从软件中心将 google浏览器图标拖到快捷栏上(12.04)参考链接:http://hi.baidu.com/kevin276/item/29bc1c96a208fabc82d29542 阅读全文
posted @ 2012-07-07 10:36 lipeil 阅读(7105) 评论(0) 推荐(0) 编辑
摘要: 1、再代码中截屏View vv = v.getRootView(); vv.setDrawingCacheEnabled(true);Bitmap bm = vv.getDrawingCache(); 2、adb 命令 -d 指定链接手机设备,当多余一台时 报错。 -e 指定链接模拟器 , 当模拟器多余一个时报错 -s 当有多个手机时 ,指定链接其中一台。例如(adb -s 10C61FA9E63E uninstall com.xyl );3、修改 “桌面” 为 desktop vim ~/.config/user-dirs.dirs 阅读全文
posted @ 2012-07-06 17:25 lipeil 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 首先确保用数据线链接后能识别设备,输入:lsusb,找到手机的vendor id和描述就出来了,htc的机器硬件id一般都是0bb4。在/etc/udev/rules.d/目录下建立70-android.rules(名字不是固定的)规则文件,内容如下:SUBSYSTEM=="usb",ATTRS{idVendor}=="0bb4",ATTRS{idProduct}=="0c86",MODE="0666"(ATTRS 、 ATTR)修改后重启udev服务sudo /etc/init.d/udev restart(su 阅读全文
posted @ 2012-07-06 14:56 lipeil 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 更改时区,时间执行tzselect按照提示进行选择时区sudo cp /usr/share/zoneinfo/Asia/ShangHai /etc/localtime执行sudo ntpdate cn.pool.ntp.orgcn.pool.ntp.org是位于中国的公共NTP服务器,用来同步你的时间时间sudo date -s 20080701详细说明:http://www.blogjava.net/mstar/archive/2008/07/01/ubuntu_set_time_timezone.html 阅读全文
posted @ 2012-07-06 09:49 lipeil 阅读(937) 评论(0) 推荐(0) 编辑
摘要: 1.安装JDK到oracle下载JDK,网址为:下载完成将JDK cp到你的安装目录下,直接执行:./jdk-6u26-linux-i586.bin(当然如果执行失败是因为没有执行权限,那么还需要加上执行权限:chmod +x ./jdk-6u26-linux-i586.bin)安装程序会自动给你安装到当前目录的jdk1.6.0_26目录下。程序安装好了,接着需要设置环境变量。执行:sudo gedit /etc/profile在配置文件中加入如下部分:export JAVA_HOME=~/..export PATH=&JAVA_HOME/bin:$PATH export CLASSP 阅读全文
posted @ 2012-07-05 23:54 lipeil 阅读(1233) 评论(0) 推荐(0) 编辑
摘要: 1、 -Wall 选项表示 输出所有的警告2、 gcc -g hello.c -o hello 编译文件 (-g 将源文件与目标文件关联) 并且可以使用 adb hello 进入调试模式 start 命令开始调试 n 下一步 s 进入函数 i locals 查看当前stack 中的变量。3、#include “send.h” 导入静态链接库 1)、gcc -c send.c 得到 send.o 2) 、ar rs libsend.a send.o 将.o文件 打包为.a文件 3)、gcc main.c -Lsend -lsend -Isend -o main ,生成可执行文件 ... 阅读全文
posted @ 2012-07-04 18:24 lipeil 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1、HVGA (Half-size VGA) ,VGA(640*480)的一半, 分辨率为(480*320)2、QVGA (QuarterVGA) ,顾名思义即VGA的四分之一尺寸,分辨率是240×320像素。3、WQVGA (Quarter Video Graphics Array),分辨率480X272(宽高比16:9)或者400X240(宽高比15:9)4、WVGA(Wide VGA),比VGA 分辨率高。WVGA的分辨率达到了800×480像素,VGA只有640×480像素5、VGA(Video Graphics Array) ,是IBM在1987年随PS 阅读全文
posted @ 2012-07-03 10:54 lipeil 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 1、android 支持的视频格式H.263 ,H.264 AVC, MPEG-4SP可以播放的文件类型(.3gp .mp4),其他的格式需要下载插件(例如flash插件) 阅读全文
posted @ 2012-07-01 19:02 lipeil 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 出现的原因是同时有多个线程或者进程对同一数据库进行写操作在三星的手机上出现的比较频繁,HTC、MOTO、HUAWEI上未发现。解决方法是1、对有写操作的方法加synchronized2、可以将对数据库的操作放在一个类中(不同对象的同步方法可以在多个线程总被同时访问)3、对数据库的方法集合类的引用使用单例(理由同上)4、或者使用静态对象锁例如:View Code static byte[] data = new byte[0]; public void Insert(String tableName ,ContentValues cv) { synchroniz... 阅读全文
posted @ 2012-06-28 16:46 lipeil 阅读(1520) 评论(0) 推荐(0) 编辑
摘要: SimpleDateFormat 将时间格式化主要的格式有yyyy-MM-dd hh:mm:ss //注意 大写的MM为月 小写的mm 为分 大写的H 与小写的h表示的时间不同(12、24);SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date = simple.parse(sDateTime); //将格式化的字符串转为DateSimpleDateFormat df=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss&quo 阅读全文
posted @ 2012-06-28 10:45 lipeil 阅读(183) 评论(0) 推荐(0) 编辑
摘要: wget-c断点续传-t retry num--read-timeout= secondsmore use man wget look for 阅读全文
posted @ 2012-06-27 23:42 lipeil 阅读(685) 评论(0) 推荐(0) 编辑
摘要: public void reflect(EditText errorEdit) { try { /**获取TextView类中 mPopup的字段*/ Field popupField = TextView.class.getDeclaredField("mPopup"); popupField.setAccessible(true); /**获取字段 在 errorEdit对象中的值 , 即mPopup对象*/ Object pop... 阅读全文
posted @ 2012-06-07 15:02 lipeil 阅读(563) 评论(0) 推荐(0) 编辑
摘要: 第一步:添加权限<uses-permissionandroid:name="android.permission.ACCESS_FINE_LOCATION"/>或者<uses-permissionandroid:name="android.permission.ACCESS_COARSE_LOCATION"/>第二步:获取LocationManager实例LocationManager mLocationManager = context.getSystemService(Context.LOCATION_SERVICE);第三步 阅读全文
posted @ 2012-06-07 11:36 lipeil 阅读(1732) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7