Android开发笔记(七)- Data Storage & Content Provider组件
这篇文章将会介绍继Activity组件,Service组件,BroadcastReceiver组件之后的最后一个组件:ContentProvider组件。相比于前三个组件,ContentProvider的概念和用法都相对简单,所以在这里再补充比较一下安卓开发中比较常见的数据存储方式及其异同。
这篇文章将会介绍继Activity组件,Service组件,BroadcastReceiver组件之后的最后一个组件:ContentProvider组件。相比于前三个组件,ContentProvider的概念和用法都相对简单,所以在这里再补充比较一下安卓开发中比较常见的数据存储方式及其异同。
To make our Android application easy to extend, modify, refactor, test or even just read it, the architecture of the application is very important. For sure we can’t have a single class MainApplication or MainActivity and put everything inside, it will be a nightmare to just read the code and understand. There are three main architectures to use in Android to build our application and gives us power to do all operations we mentioned above: Model-View-Controller(MVC)
, Model-View-PResenter(MVP)
and Model-View-VIewModel(MVVM)
. Let’s talk about them one by one.
在介绍了Activity组件和Service组件之后,这篇文章将会介绍Android开发中的第三个重要组件:BroadcastRecevier。简单来说,BroadcastReceiver
主要用于监听、接收来自Android系统或者其他应用程序的广播信息,是用于不同APP之间,以及APP和Android系统之间通信的重要工具。APP可以根据接收到的信息,采取不同的操作来进行响应。
在Android开发笔记之基础篇(二)中,我们简单总结了Activity组件的特性和使用方法。在其之后的第二个重要组件就是Service(服务)。简单来说,如果说Activity是负责处理与用户交互的UI部分的内容,那么Service则是负责在后台处理一些长时间,大型的操作或计算的内容。今天我们就继续来看看Service组件的特性以及使用方法。
In Android development, I’m always confused about the properties in build.gradle
like compileSdkVersion, targetSdkVersion, minSdkVersion etc. To end up this confusion and make it clear, after I read offical Google docuement and some posts, here is a short conclusion to explain each of them and compare the diff.
Java Reflection is a process of examining the runtime behavior of a class. This feature is also known as dynamic programming since all attributes, interfaces, constructors, fields and methods of a class can be inspecting and verifying during runtime. Futhurmore, we can instantiate new objects, invoke methods, and get or set field values using reflection as well. So let’s see what is reflection and how to use it in this post.
在编译代码,生成Android APK文件时,为了缩减生成安装包apk文件的大小,Google官方在Android Gradle插件中提供了几种不同的优化方式:Proguard,D8,R8。它们主要用于对生成的apk文件进行代码缩减(Code shrinking),资源缩减(Resource shrinking),混淆处理(Obfuscation)和优化(Optimization)。这篇文章会首先介绍一下这些编译器的产生顺序以及原因,然后再介绍一下proguard-rules.pro
中规则的定义方法。
Lambda Expression is a very useful tool and it makes the code concise and elegant. It’s not a very hard concept to understand but still need some kind of conclusion or summary. So in this post I will have a brief introduction on what is lambda expression with several examples how to use it. My example are using Kotlin lanuage, but it has the same pattern or other languages like Java and C++.
这篇文章中将会列出在Android开发中经常遇到并且容易混淆的概念,他们基本都是成对出现并且需要进行比较异同的。这其中不光设计安卓的知识,也有关于Java和Kotlin语言特性的一些基本概念。在面试时很多成对的概念会同时出现并被问到异同,这篇文章也会持续更新碰到的各种易混淆概念。
Reactive programming这个概念我在最近的安卓开发中极其频繁的接触到,但是对于从没有接触过的我来说,很多概念还是有点抽象和难以理解。所以这篇博客就来梳理一下在进行了一些了解和学习后,关于所谓“响应式编程”的我自己的理解。这里的例子主要都是应用于RxJava中,但实际上在稍微接触了RxSwift以及RxCocoa之后,我认为它们的基本概念都是相同的,所以了解RxJava之后,RxSwift和RxCocoa就完全不在话下。