Android程序员必备精品资源

平时写程序中不断收集到的一些比较常用的东西,分享给大家.

实用工具集锦

Chrome 插件

IDE 插件

Android Apps

技术集锦

Best Resources for Android Development

From: http://www.androidauthority.com/best-resources-android-development-372414/

android developer development

Alper Çuğun

Whether you’re a seasoned professional or just beginning with Android development, this list of resources (including tools, libraries, and blogs) is useful for any developer or team on just about any project, big or small.

OkHttp

GitHub Square Ok

OkHttp, a product of Square, is an open-source HTTP and SPDY library for Android and Java. Android comes with two existing HTTP frameworks (HttpURLConnection and HttpClient) but over various Android OS versions have been rife with bugs that can make any normally-sane developer go nuts trying to nail down an HTTP problem. Fortunately, OkHttp solves many of the problems. OkHttp is built upon HttpUrlConnection — so the API should be familiar — but stays up-to-date with fixes from the Android codebase, meaning no compatibility nightmares with older OS versions. Oh, and if you’re looking for something that implements the Apache HttpClient API, that exists as a module: okhttp-apache.

Check out OkHttp Read on →

Android Context,What Context?

From: http://www.doubleencore.com/2013/06/context/

Context is probably the most used element in Android applications…it may also be the most misused.

  Context objects are so common, and get passed around so frequently, it can be easy to create a situation you didn’t intend.  Loading resources, launching a new Activity, obtaining a system service, getting internal file paths, and creating views all require a Context (and that’s not even getting started on the full list!) to accomplish the task.  What I’d like to do is provide for you some insights on how Context works alongside some tips that will (hopefully) allow you to leverage it more effectively in your applications.

Context Types

  Not all Context instances are created equal.  Depending on the Android application component, the Context you have access to varies slightly:

Application

  is a singleton instance running in your application process.  It can be accessed via methods like getApplication() from an Activity or Service, and getApplicationContext() from any other object that inherits from Context.  Regardless of where or how it is accessed, you will always receive the same instance from within your process.

Activity/Service

  inherit from ContextWrapper which implements the same API, but proxies all of its method calls to a hidden internal Context instance, also known as its base context.  Whenever the framework creates a new Activity or Service instance, it also creates a new ContextImpl instance to do all of the heavy lifting that either component will wrap.  Each Activity or Service, and their corresponding base context, are unique per-instance.

BroadcastReceiver

  is not a Context in and of itself, but the framework passes a Context to it in onReceive() each time a new broadcast event comes in.  This instance is a ReceiverRestrictedContext with two main functions disabled; calling registerReceiver() and bindService().  These two functions are not allowed from within an existing BroadcastReceiver.onReceive().  Each time a receiver processes a broadcast, the Context handed to it is a new instance.

ContentProvider

  is also not a Context but is given one when created that can be accessed via getContext().  If the ContentProvider is running local to the caller (i.e. same application process), then this will actually return the same Application singleton.  However, if the two are in separate processes, this will be a newly created instance representing the package the provider is running in.

Read on →

Google Java 编程风格指南

作者:Hawstein
出处:http://hawstein.com/posts/google-java-style.html
声明:本文采用以下协议进行授权: 自由转载-非商用-非衍生-保持署名|Creative Commons BY-NC-ND 3.0 ,转载请注明作者及出处。

目录

  1. 前言
  2. 源文件基础
  3. 源文件结构
  4. 格式
  5. 命名约定
  6. 编程实践
  7. Javadoc
  8. 后记

前言

这份文档是Google Java编程风格规范的完整定义。当且仅当一个Java源文件符合此文档中的规则, 我们才认为它符合Google的Java编程风格。

与其它的编程风格指南一样,这里所讨论的不仅仅是编码格式美不美观的问题, 同时也讨论一些约定及编码标准。然而,这份文档主要侧重于我们所普遍遵循的规则, 对于那些不是明确强制要求的,我们尽量避免提供意见。

1.1 术语说明

在本文档中,除非另有说明:

  1. 术语class可表示一个普通类,枚举类,接口或是annotation类型(@interface)
  2. 术语comment只用来指代实现的注释(implementation comments),我们不使用“documentation comments”一词,而是用Javadoc。

其他的术语说明会偶尔在后面的文档出现。

1.2 指南说明

本文档中的示例代码并不作为规范。也就是说,虽然示例代码是遵循Google编程风格,但并不意味着这是展现这些代码的唯一方式。 示例中的格式选择不应该被强制定为规则。 Read on →

零基础开始学习Vim-学习Vim应该是快乐的~~

案情回顾

  上一篇文章零基础开始学习Vim-新手入门有介绍一些学习Vim的资源.
  对于从来没有用过Vim的同学,看到上一篇文章时候,有多少人马上开始动手了呢?
  刚刚开始接触Vim,一定是无从下手的,甚至会找不到动力去学习和练习!!!至少开始的时候卤煮是这样的.

有趣的入门学习

两个有趣的Vim入门小游戏

VimAdventures


  这个小游戏是特别有意思,可以在玩这个游戏的过程中熟悉Vim的热键
  记得最初是在左耳朵耗子的博客酷壳-CoolShell.cn中看见的.

想要玩游戏的同学点我

VimGenius


  还有这个在线Vim闯关练习的网站交互做的也很有意思.可以比上面那个学到更多 http://vimgenius.com/

巩固练习

  上面两个小游戏都分别闯关之后…… To Be Continue

Vim

零基础开始学习Vim-新手入门

不折不扣的工具控,自从看到有同事飞码穿梭在Vim之间,就无缘无故的迷恋上了.
别光看到别人的帅,别人帅是因为什么呢,好好想一下,如果我们也想这么帅,该怎么办呢…
苦思冥想没用的,还是好好的从头学起吧,谁让你出生的时候没有被动技能(自动掌握Vim进行高效编码)呢….

新手入门vimtutor

Vim怎么入门呢???
其实最容易的就是直接在命令行执行 vimtutor 即可进入帮助文档
一进去,又全是英文,头都大了是不是…要做一个优秀的程序员,必须英文好对吧……
要被鄙视的节奏,谁都想看英文帮助文档,但是现在(2013140101),也没能力看懂.真的
但总不能现在特别想学Vim,还得绕一大弯路去花上年把两年学好英语再开始学吧???

只能采用迂回战术了,一边编程一边学英语,嗯,真是太机智了.
那我们在命令行输入 vimtutor zh 就进入中文的新手入门了,把这篇文章看完练习完生存模式就通关了 哈哈哈

那最好的入门方式就是一边看Vim的vimtutor一边进行操作吧,很快就通关啦.记得复习

新手入门进阶

上面的练习做完之后,可以考虑接下来的练习了
Read on →

Vim

重装系统后恢复Octopress

restore-the-octopress-after-reshipment-system

如何你想学习如何基于github搭建一个自己的Octopress博客,请参考以下两篇文章哈

Mac重装了很久,一直也没有恢复Octopross的博客系统.今天是2013年最后一天啦,顺手弄弄.

这一切基于你的Mac环境什么都妥妥的了.比如xcode,git,ruby…等等

0. 首先是把项目clone到本地,接着开始吧

1
2
3
4
5
6
7
8
○ git clone git@github.com:wuyexiong/wuyexiong.github.com.git
Cloning into 'wuyexiong.github.com'...
remote: Counting objects: 5004, done.
remote: Compressing objects: 100% (1758/1758), done.
remote: Total 5004 (delta 2798), reused 5002 (delta 2797)
Receiving objects: 100% (5004/5004), 1.47 MiB | 340.00 KiB/s, done.
Resolving deltas: 100% (2798/2798), done.
Checking connectivity... done

1. 切换到source分支下

1
2
3
± git checkout source
Branch source set up to track remote branch source from origin.
Switched to a new branch 'source'
1
2
3
4
5
6
± git branch -a
  master
* source
  remotes/origin/HEAD -> origin/master
  remotes/origin/master
  remotes/origin/source
Read on →
Mac

Java NIO系列教程(五) 通道之间的数据传输

本文为转载 感谢并发编程网
译文原文地址:http://ifeve.com/java-nio-channel-to-channel/
英文原文地址:http://tutorials.jenkov.com/java-nio/scatter-gather.html

1
作者:Jakob Jenkov   译者:郭蕾     校对:周泰

在Java NIO中,如果两个通道中有一个是FileChannel,那你可以直接将数据从一个channel(译者注:channel中文常译作通道)传输到另外一个channel。

transferFrom()

FileChannel的transferFrom()方法可以将数据从源通道传输到FileChannel中(译者注:这个方法在JDK文档中的解释为将字节从给定的可读取字节通道传输到此通道的文件中)。下面是一个简单的例子:

1
2
3
4
5
6
7
8
9
10
RandomAccessFile fromFile = new RandomAccessFile("fromFile.txt", "rw");
FileChannel      fromChannel = fromFile.getChannel();

RandomAccessFile toFile = new RandomAccessFile("toFile.txt", "rw");
FileChannel      toChannel = toFile.getChannel();

long position = 0;
long count = fromChannel.size();

toChannel.transferFrom(position, count, fromChannel);
Read on →

Java NIO系列教程(四) Scatter/Gather

本文为转载 感谢并发编程网
译文原文地址:http://ifeve.com/java-nio-scattergather/
英文原文地址:http://tutorials.jenkov.com/java-nio/scatter-gather.html

1
作者:Jakob Jenkov   译者:郭蕾  

Java NIO开始支持scatter/gather,scatter/gather用于描述从Channel(译者注:Channel在中文经常翻译为通道)中读取或者写入到Channel的操作。

分散(scatter)从Channel中读取是指在读操作时将读取的数据写入多个buffer中。因此,Channel将从Channel中读取的数据“分散(scatter)”到多个Buffer中。

聚集(gather)写入Channel是指在写操作时将多个buffer的数据写入同一个Channel,因此,Channel 将多个Buffer中的数据“聚集(gather)”后发送到Channel。

Scattering Reads

Scattering Reads是指数据从一个channel读取到多个buffer中。

如下图描述 Read on →

Java NIO系列教程(三) Buffer

本文为转载 感谢并发编程网
译文原文地址:http://ifeve.com/buffers/
英文原文地址:http://tutorials.jenkov.com/java-nio/buffers.html

1
作者:Jakob Jenkov     译者:airu     校对:丁一

Java NIO中的Buffer用于和NIO通道进行交互。如你所知,数据是从通道读入缓冲区,从缓冲区写入到通道中的。

缓冲区本质上是一块可以写入数据,然后可以从中读取数据的内存。这块内存被包装成NIO Buffer对象,并提供了一组方法,用来方便的访问该块内存。

下面是NIO Buffer相关的话题列表:

  1. Buffer的基本用法
  2. Buffer的capacity,position和limit
  3. Buffer的类型
  4. Buffer的分配
  5. 向Buffer中写数据
  6. flip()方法
  7. 从Buffer中读取数据
  8. clear()与compact()方法
  9. mark()与reset()方法
  10. equals()与compareTo()方法
Read on →