- 博客(13)
- 资源 (1)
- 收藏
- 关注
原创 自定义View实现单击,双击效果
自定义View,1. 自定义一个Runnable线程TouchEventCountThread , 用来统计500ms内的点击次数2. 在MyView中的 onTouchEvent 中调用 上面的线程3. 自定义一个Handler, 在TouchEventHandler 中 处理 统计到的点击事件, 单击, 双击, 三击, 都可以处理 核心代码如下:
2016-08-29 14:50:15 739
原创 十进制与各进制之间的转换
public class trans { public static void main(String[] args) { toHex(60);//输出3C } //十进制转换为二进制 public static void toBin(int num) { trans(num,1,1); }
2016-08-28 17:52:08 188
原创 Java实现生产者与消费者
生产者与消费者的线程实现问题分析可知:问题含有产品对象,产品池对象,消费者,生产者对象产品对象public class Product { int id; String name; Product(){} Product(int id,String name){ this.name=name; this.id=id; } public int getId() { r
2016-08-28 15:48:59 604
原创 Service的onStartCommand()返回的三个参数的意义
在Android开发中,调用Context的startService方法启动Service的生命周期时,如果Android面临内存匮乏,可能会销毁掉你当前运行的Service,然后待内存充足的时候可以重新创建Service,Service被Android系统强制销毁并再次重建的行为依赖于Service中onStartCommand方法的返回值。而Service onStartCommand方法
2016-08-20 13:42:31 905
转载 android代码访问APN数据
无论是移动、联通还是电信,都至少提供了两种类型的的APN:WAP方式和NET方式。其中NET方式跟WIFI方式一样,无需任何设置,可自由访问所有类型网站,而WAP方式,需要手机先设置代理服务器和端口号等信息,并且只能访问HTTP协议类型的网站。1) 移动的WAP名称是CMWAP,NET名称是CMNET;2) 联通的WAP名称是UNIWAP,NET名称是UNINET;联通3G的WAP
2016-08-20 13:00:02 4123
原创 android属性动画2
1:使用xml文件创建属性动画首先在res下建立animator文件夹,然后建立res/animator/scalex.xmlobjectAnimator xmlns:android="http://schemas.android.com/apk/res/android" android:duration="1000" android:prope
2016-08-20 09:59:09 355
原创 android动画之属性动画1
1:安卓中的动画简述android中的几种动画:View Animation (补间动画);Drawable Animation(帧动画); Property Animation(属性动画)1.1:帧动画的简单实用(1):在res/anim/...xml文件下定义xml文件xml version="1.0" encoding="utf-8"?> 根标签
2016-08-20 09:12:31 430
转载 touch事件的分发机制
Android 中与 Touch 事件相关的方法包括:dispatchTouchEvent(MotionEvent ev)、onInterceptTouchEvent(MotionEvent ev)、onTouchEvent(MotionEvent ev);能够响应这些方法的控件包括:ViewGroup、View、Activity。继承ViewGroup的大多是容器控件,如LinearLa
2016-08-19 13:32:49 343
原创 横竖屏切换的生命周期
1、新建一个Activity,并把各个生命周期打印出来2、运行Activity,得到如下信息onCreate-->onStart-->onResume-->3、按crtl+f12切换成横屏时onSaveInstanceState-->onPause-->onStop-->onDestroy-->onCreate-->onStart-->
2016-08-19 13:29:13 349
原创 Android Activity的onSaveInstanceState() 和 onRestoreInstanceState()调用
onsaveinstancestate()的特征
2016-08-05 17:41:35 291
原创 n皇后问题求解 java
请设计一种算法,解决著名的n皇后问题。这里的n皇后问题指在一个nxn的棋盘上放置n个棋子,使得每行每列和每条对角线上都只有一个棋子,求其摆放的方法数。给定一个int n,请返回方法数,保证n小于等于10
2016-08-04 08:45:45 428
android源码连连看
2015-08-24
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人