自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Roy Sun

Improve the quality of code! Email: onecoders#gmail.com

  • 博客(31)
  • 收藏
  • 关注

转载 How-to: Customize Android progress bars

IntroductionThis how-to will show you how to customize Android’s default progress bar to fully suit your needs. You will create an application that demonstrates different styles of progress bar. The

2013-08-05 14:52:14 1478

转载 Custom Progress Bar In Android

Android Development TutorialCustomized Progress BarIn Android we can customize the Progress Bar and make it more attractive and beutifull.Customize Progress Bar ExampleHere I have  use

2013-08-05 13:19:48 1289

转载 Android Unique Device ID

There are several occasions when the unique identifier of a device is required. For instance you need it to generate a serial key and unlock a trial version, to generate encryption keys or to have the

2013-07-28 18:40:19 1136

转载 Android URI简介

就Android平台而言,URI主要分三个部分:scheme, authority and path。其中authority又分为host和port。格式如下:scheme://host:port/path举个实际的例子:content://com.example.project:200/folder/subfolder/etc\---------/  \-------------

2013-07-28 15:02:29 654

转载 Zipping Files with Android (Programmatically)

One majorly annoying issue that I stumbled upon, was the fact that I couldn't send multiple attachments using Intents to the Google Mail app. The quickest way around that was of course to compress all

2013-07-27 15:25:51 794

转载 Basic Git commands

Here is a list of some basic Git commands to get you going with Git.For more detail, check out the Atlassian Git Tutorials for a visual introduction to Git commands and workflows, including exampl

2013-07-24 16:54:42 840

转载 Android EditText with custom font and clear button

C’mon, admit it, you’ve always wanted this. Have you ever felt that text clearing in your android application on EditTexts feels… wrong ?So, what do we want to achive?Plain and simple, a TextView,

2013-06-25 15:28:41 4294

转载 Java Regular Expression Tutorial

This tutorial is aimed to help you mastering java regular expression and for me to come back at regular interval to refresh my regular expressions learning.What Are Regular Expressions?A regular

2013-06-24 16:52:40 1415

转载 [Android] JAR Library: Export and Import

Export LibraryPrepare source codeCreate an Android projectCreate source code, and fix all bugRemove res/*Remove unused source filesEdit AndroidManifest.xml to remove the statements that refe

2013-06-20 11:57:15 1229

转载 Git: How To Revert A Branch Merge

This was a stumper for me a while back. Jason Meridth posted on reseting / reverting git commits and I had a question in the comments. My specific situation was about having a branch merged at the w

2013-06-19 13:48:09 1530

转载 在Eclipse中使用JUnit4进行单元测试

我们在编写大型程序的时候,需要写成千上万个方法或函数,这些函数的功能可能很强大,但我们在程序中只用到该函数的一小部分功能,并且经过调试可以确定,这 一小部分功能是正确的。但是,我们同时应该确保每一个函数都完全正确,因为如果我们今后如果对程序进行扩展,用到了某个函数的其他功能,而这个功能有bug的话,那绝对是一件非常郁闷的事情。所以说,每编写完一个函数之后,都应该对这个函数的方方面面进行测试,这样的

2013-06-18 09:45:47 818

转载 How to Push a New Local Branch to a Remote Git Repository

You might find yourself in a situation where you have a branch that you created locally and want to push to a remote git repository. Suppose you created a localplugin branch that you want to expose

2013-06-09 13:20:24 1656

转载 Ubuntu 12.04常用的快捷键

超级键操作 1、超级键(Win键)–打开dash。  www.2cto.com  2、长按超级键– 启动Launcher。并快捷键列表。 3、按住超级键,再按1,2,3等数字键–从Launcher打开一个应用程序,当你按住超级键时,每个应用程序图标上都会显示一个数字,按下对应的数字就会打开盖应用程序。 4、超级键+A–从Launc

2013-06-07 19:23:35 692

转载 boot空间不足的问题

解决更新需要花去 x M 磁盘上总计 /boot 的空间。请在 磁盘上流出 /boot 空间。sudo apt-get clean系统自动升级会安装多个内核,卸载多余的内核可以获得更多磁盘空间$ df -h文件系统                                容量  已用  可用   已用%   挂载点/dev/mapper/ubuntu-root

2013-06-05 09:01:03 1449

转载 Java回调函数的理解

所谓回调,就是客户程序C调用服务程序S中的某个函数A,然后S又在某个时候反过来调用C中的某个函数B,对于C来说,这个B便叫做回调函数。例如Win32下的窗口过程函数就是一个典型的回调函数。一般说来,C不会自己调用B,C提供B的目的就是让S来调用它,而且是C不得不提供。由于S并不知道C提供的B姓甚名谁,所以S会约定B的接口规范(函数原型),然后由C提前通过S的一个函数R告诉S自己将要使用B函数,这个

2013-06-04 12:37:16 617

转载 Android MD5校验码的生成与算法实现

在Java中,java.security.MessageDigest (rt.jar中)已经定义了 MD5 的计算,所以我们只需要简单地调用即可得到 MD5 的128 位整数。然后将此 128 位计 16 个字节转换成 16 进制表示即可。     下面是一个可生成字符串或文件MD5校验码的例子,测试过,可当做工具类直接使用,其中最主要的是getMD5String(Strings)和get

2013-05-29 17:23:28 1360

转载 java中的IO整理

写在前面:本文章基本覆盖了java IO的全部内容,java新IO没有涉及,因为我想和这个分开,以突出那个的重要性,新IO哪一篇文章还没有开始写,估计很快就能和大家见面。照旧,文章依旧以例子为主,因为讲解内容的java书很多了,我觉的学以致用才是真。代码是写出来的,不是看出来的。最后欢迎大家提出意见和建议。【案例1】创建一个新文件?1234

2013-05-28 16:49:00 695

转载 transient java

java语言的关键字,变量修饰符,如果用transient声明一个实例变量,当对象存储时,它的值不需要维持。Java的serialization提供了一种持久化对象实例的机制。当持久化对象时,可能有一个特殊的对象数据成员,我们不想用serialization机制来保存它。为了在一个特定对象的一个域上关闭serialization,可以在这个域前加上关键字transient。当一个对象被序列化的

2013-05-28 09:37:38 484

转载 Android升级ADT22后会报ClassNotFoundException的原因分析

最近有个同事跟我报怨说,他的系统重装Eclipse使用新的ADT22后,编译的android apk运行总会报ClassNotFoundException错误。我说这怎么可能,谷歌这么大的公司出来的东西怎么可能有这种问题。他说不信你试试,我说试试就试试。我之前用的是ADT21,结果升到ADT22后一运行,晕,不得不服,还果真是ClassNotFound了。接下来我又换了几个工程编译运行,发现并

2013-05-25 14:14:30 552

转载 关于相对布局RelativeLayout的各种属性介绍

RelativeLayout相对布局是个人觉得在android布局中比较常用且好用的一个,当然如果想让布局更漂亮是需要多种布局混合搭建的,这里就需要更深入的学习了,在这只介绍下有关相对布局的东西。相对于兄弟元素android:layout_below="@id/aaa":在指定View的下方android:layout_above="@id/xxx":在指定View的上方and

2013-05-17 14:02:01 707

转载 ViewPager多页面滑动切换以及动画效果

一、首先,我们来看一下效果图,这是新浪微博的Tab滑动效果。我们可以手势滑动,也可以点击上面的头标进行切换。与此同方式,白色横条会移动到相应的页卡头标下。这是一个动画效果,白条是缓慢滑动过去的。好了,接下来我们就来实现它。  二、在开始前,我们先要认识一个控件,ViewPager。它是google SDk中自带的一个附加包的一个类,可以用来实现屏幕间的切换。这个附加包是android-su

2013-05-15 10:25:35 686

转载 Support different Android device configurations with dimension resources

Takeaway: Dimension resources simplify the task of building and maintaining a flexible Android app that looks good on various devices. Follow these best practices when using dimension resources.A be

2013-05-03 18:39:35 883

转载 Android中Dimension的计量单位详解

px:是屏幕的像素点in:英寸mm:毫米pt:磅,1/72 英寸dp:一个基于density的抽象单位,如果一个160dpi的屏幕,1dp=1pxdip:等同于dpsp:同dp相似,但还会根据用户的字体大小偏好来缩放。建议使用sp作为文本的单位,其它用dip针对dip和px 的关系,做以下概述:HVGA屏density=160;QVGA屏density=120;

2013-05-03 18:13:50 1278

转载 深度解析Android中字体设置

1、在Android XML文件中设置字体 可以采用Android:typeface,例如android:typeface=”monospace”。在这里例子中我们在Activity中对android:text=”Hello, World! 您好”分别进行了四种显示方式,依次为“Sans”,“serif”,“monospace”和系统缺省方式(经试验缺省采用采用sans)。英文字体有差异,貌似

2013-05-02 09:25:25 715

转载 Generating SSH Keys

If you have decided not to use the recommended HTTPS method, we can use SSH keys to establish a secure connection between your computer and GitHub. The steps below will walk you through generating a

2013-04-28 10:30:04 931

原创 Git版本控制:利用git reset恢复档案,暂寸状态,commit讯息

git commit后去除此次commit的修改,返回之前的版本方法:     git reset --hard     git push origin HEAD --force其他:    根据–soft –mixed –hard,会对working tree和index和HEAD进行重置:    git reset –mixed:此为默认

2013-04-27 17:29:36 1041

转载 Java中的Enum用法介绍

1. 关于Java Enum:学过C/C++等语言的人,应该都对Enum类型略知一二。Enum一般用来表示一组相同类型的常量。如性别、日期、月份、颜色等。对这些属性用常量的好处是显而易见的,不仅可以保证单例,且比较时候可以用”==”来替换equals。是一种好的习惯。JDK1.5之前没有Enum这个类型,那时候一般用接口常量来替代。有了JavaEnum之后,可以更贴近的表示这种常量。2.

2013-04-22 18:59:38 612

转载 Java中判断字符串是否是一个整数

1.使用类型转换判断   1 try {    2              String str="123abc";    3             int num=Integer.valueOf(str);//把字符串强制转换为数字    4             return true;//如果是数字,返回True    5          } catch (E

2013-04-21 12:49:10 1486

转载 android使用adb命令安装软件

准备工作:确信 \android-sdk-windows\tools\下有 adb.exe     AdbWinApi.dll     AdbWinUsbApi.dll 三个文件,如果没有从\android-sdk-windows\platform-tools\ 下面拷贝到tools下(android sdk 3.0 以上版本一些工具默认不放在tools下,作为可选配置放在platform-t

2013-04-18 17:09:46 1242

转载 Java多线程

(1)继承Thread类,重写run函数 创建: class xx extends Thread{ public void run(){ Thread.sleep(1000) //线程休眠1000毫秒,sleep使线程进入Block状态,并释放资源 }} 开启线程: 对象.start() //启动线程,run函数运行 (2)实现Runnable接口,重写run函

2013-04-12 09:46:24 603

转载 关于Traceview的使用

Traceview是android平台配备一个很好的性能分析的工具。它可以通过图形化的方式让我们了解我们要跟踪的程序的性能,并且能具体到method。下面我们看下如何使用这个东东。首先,我们必须在程序当中加入代码,以便生成trace文件,有了这个trace文件我们才可以将其转化为图形。要添加的代码如下:Java代码  // start tracing to "/sd

2013-04-11 16:27:17 703

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除