随笔分类 -  android

上一页 1 ··· 5 6 7 8 9
摘要:第一步:定义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 阅读(3225) 评论(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 阅读(7163) 评论(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、再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 阅读(656) 评论(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) 编辑
摘要:第一步:配置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) 编辑
摘要: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) 编辑
摘要: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、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 阅读(1521) 评论(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 阅读(564) 评论(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 阅读(1733) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9