`
kingbinchow
  • 浏览: 122946 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
文章列表
interface LetterProcess { public void writeContext(String context); public void fillEnvelope(String address); public void letterIntoEnvelope(); public void sendLetter(); } class PersonWriteLetter implements LetterProcess { @Override public void writeContext(String context) { ...
/** * * @author king * * 查找类接口 */ public class ClassUtils { public static List<Class> getAllClassByInterface(Class c) {//按照接口字母顺序查找 List<Class> returnClassList = new ArrayList<Class>(); if (c.isInterface()) { String packageName = c.getPackage().getName( ...
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { measuredHeight = measureHeight(heightMeasureSpec); measuredWidth = measureWidth(widthMeasureSpec); setMeasuredDimension(measuredWidth, measuredHeight); } private int measureWidth(int widthMeasureSpec) { ...

AsynTask

...
在使用EditText的XML 文件中加入一个属性: android:textCursorDrawable="@null" android:textCursorDrawable   这个属性是用来控制光标颜色的, "@null"   是作用是让光标颜色和text color一样 android:textCursorDrawable 的用法可以查看android sdk
import java.util.Observable; import java.util.Observer; /** * * @author King * 本例中:被观察者为偷钱包的贼,观察者为抓贼的警察 * 贼一旦发生偷钱包行为,就会被警察抓住 * */ public class ObservePattern { public static void main(String args[]){ Thief thief1 = new Thief(); Police police1 = new Polic ...
进入Activity就弹出PopupWindow 来,结果编译运行后报异常:“android.view.WindowManager$BadTokenException: Unable to add window -- token android.app.LocalActivityManager$LocalActivityRecord@983iefd89 is not valid; is your activity running? ” 后来发现,是要等Activity都进行完,才能pop出这个popupwindow; 解决方案: 在你所想弹出的布局中 yourLayout.post(new R ...
import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; /** * * @author King * @Date 2010-7-19 * */ public class InputStreamUtils { final static int BUFFER_SIZE = 4096; /** * 将InputStream转换成String ...
附件:JDBC mysql-driver MySQL:        String Driver="com.mysql.jdbc.Driver"; //驱动程序 String URL="jdbc:mysql://localhost:3306/db_name"?useUnicode=true&amp;characterEncoding=UTF-8; //连接的URL,db_name为数据库名,注意修改编码类型 String Username="username"; //用户名 S ...

JDBC连接数据库(上)

    博客分类:
  • java
  •创建一个以JDBC连接数据库的程序:    1、加载JDBC驱动程序    在连接数据库之前,首先要加载想要连接的数据库的驱动到JVM(Java虚拟机),        这通过java.lang.Class类的静态方法forName(String  className)实现。        例如:       try{ //加载MySql的驱动类 Class.forName("com.mysql.jdbc.Driver") ; }catch(ClassNotFoundException e){ ...
sqlite3中的数据类型 大多数的数据库引擎(到现在据我们所知的除了sqlite的每个sql数据库引擎)都使用静态的、刚性的类型,使用静态类型,数据的类型就由它的容器决定,这个容器是这个指被存放的特定列。 Sqlite使用一个更一般的动态类型系统,sqlite中,值的数据类型跟值本身相关,而不是与它的容器相关。Sqlite的动态类型系统和其他数据库的更为一般的静态类型系统相兼容,但同时,sqlite中的动态类型允许它能做到一些传统刚性类型数据库所不可能做到的事。 1.  存储类和数据类型 每个存放在sqlite数据库中(或者由这个数据库引擎操作)的值都有下面中的一个存储类: ...
LinearLayout和RelativeLayout共有属性: android:id="@+id/btn1" 控件宽度 android:layout_width="80px" //"80dip"或"80dp" android:layout_width =“wrap_content” android:layout_width =“match_parent” 控件高度 android:layout_height="80px" //"80dip"或" ...
Question: 工程之前一直正常运行,今早上 突然报出 Syntax error, static imports are only available if source level is 1.5 Solution: 各种调试之后,在buildpath中 有多余的Libraries加入,以前一直以为是android自带的jar包:Android Dependencies;删除此包即可

android--JNI (转)

The JNI is designed to handle situations where you need to combine Java applications with native code. As a two-way interface, the JNI can support two types of native code: native libraries and native applications. JNI就是让Java代码与native代码(比如C和C++)交互的一种机制。 《The JNI Programmer's Guide and Specificatio ...
Question: “The Java bug was closed for voting and comments at 6969236 on the Java BugParade because the change has been reverted; the related Eclipse bug report is open for oting and comments at bug 319514. ”-引用eclipse官网 Solution: 打开eclipse安装目录下的eclipse.ini,修改–launcher.XXMaxPermSize属性,其中此属性有两处 -s ...
Global site tag (gtag.js) - Google Analytics