Thoughts on Content Handling in Android Application

Introduction

For content-oriented Android application, how and where to store the content to display is a issue every developer will be concerned with. The Android framework provided a comprehensive solution with ContentProvider (and a lot more) which suits quite well with a SQLite database; but in a lot of other scenarios, the app only need to have some information cached, while the majority of content is directly retrieved from network, thus eliminating the need for a database (and a complicated content scheme).

But when we look into the core of this issue, we will soon find out that it is in fact a problem of whether to have a central storage, and how to notify different components about a change.

继续阅读



关于 C 语言的面试问题

由来

这是我在作为学生组织的面试官时,对熟练掌握 C/C++ 的面试者提出几个的问题,以及对于这几个问题我自己的答案。

语法规则和特定技巧很大程度上只是记忆的问题,而在几个事实上知晓与否并不能断定面试者的高下。C 语言是一门十分接近底层实现的语言,许多的设计决定与实现直接相关,如果想要合适地运用,也要求程序员对于 C 的实现有透彻的理解。因此,这几个问题主要考察的是面试者在 C 原理与设计层面上的理解。

继续阅读




LinearLayout 的拖放操作和动画

前言

Android 中ListView的拖放操作和动画实现已经被这个 DevByte相关的样例说明,并且也有 ListViewAnimations 这样强大的开源库进行了集成。但是,一番 Google 后,我发现基于LinearLayout的相关实现却不多。

然而,有时我们可能需要使用LinearLayout替代ListView来实现列表,例如不需要ListView的视图回收机制(比如使用Fragment作为列表项),或者我们需要把这个视图放在ScrollView中。

在使用LinearLayout实现拖放和动画时,实现代码相比于之前提到的ListView实现也需要一些变动。因为我在网络上没有找到相应的资料,所以写下这篇文章来记录这个过程。

继续阅读





Arch Linux Notes

This is my notebook for some small tips and tricks when using Arch Linux.

Why Arch Linux?

  • It is fresh and simple in package dependency.

  • It has a powerful Arch User Repository and makes it easy for you to make/modify your package.

  • It has a detailed Arch Wiki comprising useful experiences and recommendations.

  • It gets you to learn the basic knowledge required to be a Linux user/administrator/programmer.

继续阅读