Android Java 框架基础[知识点汇总]

简介: 学习android的过程中,把整个框架的基础结构牢记很重要,特此摘录了一些这个框架的一些基础知识,在使用的过程中按照这个框架学习,事半功倍。 开发过程中参考JDK的文档和android的sdk文档可以清楚遇到的很多问题,遇到问题是现在这两个文档中一般都能找到原因(安装sdk的文档参考http://www.

学习android的过程中,把整个框架的基础结构牢记很重要,特此摘录了一些这个框架的一些基础知识,在使用的过程中按照这个框架学习,事半功倍。

开发过程中参考JDK的文档和android的sdk文档可以清楚遇到的很多问题,遇到问题是现在这两个文档中一般都能找到原因(安装sdk的文档参考http://www.cnblogs.com/2018/archive/2011/02/17/1957356.html

分层结构Android Layers

Ø Prominent code libraries, including:

– Browser technology from WebKit, the same open source engine powering Mac’s Safari and the iPhone’s Mobile Safari browser. WebKit has become the de facto standard for most mobile platforms.

– Database support via SQLite, an easy-to-use SQL database.

– Advanced graphics support, including 2D, 3D, animation from Scalable Games Language (SGL), and OpenGL ES.

– Audio and video media support from PacketVideo’sOpenCORE, and Google’s own Stagefright media framework.

– Secure Sockets Layer (SSL) capabilities from the Apache project.

Ø An array of managers that provide service

– Activities and views – Telephony

– Windows – Resources

– Location-based services

Ø The Android runtime, which provides:

– Core Java packages for a nearly full-featured Java programming environment. Note that this isn’t a Java ME environment.

– The Dalvik VM employs services of the Linux-based kernel to provide an environment to host Android applications.

Ø A Linux kernel

provides a foundational hardware abstraction layer, as well as core services such as process, memory, and filesystem management. The kernel is where hardware-specific drivers are implemented—capabilities such as Wi-Fi and Bluetooth are here. The Android stack is designed to be flexible, with many optional components that largely rely on the availability of specific hardware on a given device. These components include features such as touch screens, cameras, GPS receivers, and accelerometers.

API Level

API Level is an integer value that uniquely identifies the framework API revision offered by a version of the Android platform.

Platform Version

API Level

Android 2.3

9

Android 2.2

8

Android 2.1

7

Android 2.0.1

6

Android 2.0

5

Android 1.6

4

Android 1.5

3

Android 1.1

2

Android 1.0

1

Intent IntentFilters

Intents and IntentFilters, Android’s innovative navigation and triggering mechanisms.

 An Intent is a declaration of need. It’s made up of a number of pieces of information that describe the desired action or service. We’re going to examine the requested action and, generically, the data that accompanies the requested action.

 An IntentFilter is a declaration of capability and interest in offering assistance to those in need. It can be generic or specific with respect to which Intents it offers to service.

The action attribute of an Intent is typically a verb,The data component of an Intent is expressed in the form of a URI

The IntentFilter defines the relationship between the Intent and the application. IntentFilters can be specific to the data portion of the Intent, the action portion, or both. IntentFilters also contain a field known as a category. The category helps classify the action.

IntentFilters are often defined in an application’s AndroidManifest.xml file with the <intent-filter> tag.

Activity

An application might have a UI, but it doesn’t have to have one. If it has a UI, it’ll have at least one Activity.

Service

If an application is to have a long lifecycle, it’s often best to put it into a Service.

BroadcastReceiver

If an application wants to receive and respond to a global event, such as a ringing phone or an incoming text message, it must register as a BroadcastReceiver.

ContentProvider

If an application manages data and needs to expose that data to other applications running in the Android environment, you should consider a ContentProvider.

AndroidManifest.xml

A fundamental fact of Android development is that an Android application contains at least one Activity, Service, BroadcastReceiver, or ContentProvider. Some of these elements advertise the Intents they’re interested in processing via the IntentFilter mechanism. All these pieces of information need to be tied together for an Android application to execute. The glue mechanism for this task of defining relationships is the AndroidManifest.xml file.

<service>Servicemight also include the <intent-filter>

<receiver>BroadcastReceivermight have an explicit <intent-filter> tag

<uses-permission>

<application

Core Android packages

 java.lang—Core Java language classes

 java.io—Input/output capabilities

 java.net—Network connections

 java.text—Text-handling utilities

 java.math—Math and number-manipulation classes

 javax.net—Network classes

 javax.security—Security-related classes

 javax.xml—DOM-based XML classes

 org.apache.*—HTTP-related classes

 org.xml—SAX-based XML classes

android.app—Android application model access

android.bluetooth—Android’s Bluetooth functionality

android.content—Accessing and publishing data in Android

android.net—Contains the Uri class, used for accessing content

android.gesture—Create, recognize, load, and save gestures

android.graphics—Graphics primitives

android.location—Location-based services (such as GPS)

android.opengl—OpenGL classes

android.os—System-level access to the Android environment

android.provider—ContentProvider-related classes

android.telephony—Telephony capability access, including support for both Code Division Multiple Access (CDMA) and Global System for Mobile communication (GSM) devices

android.text—Text layout

android.util—Collection of utilities for logging and text manipulation, including XML

android.view—UI elements

android.webkit—Browser functionality

android.widget—More UI elements

Application Fundamentals

SDK的文档目录file:///。。。/android-sdk-windows/docs/guide/topics/fundamentals.html 有详细的说明

Activity lifecycle

As an activity transitions from state to state, it is notified of the change by calls to the following protected methods:

voidonCreate(Bundle savedInstanceState)
void onStart()
void onRestart()
void onResume()
void onPause()
void onStop()
void onDestroy()

由Android SDK/NDK默认管理的目录和文件:

AndroidManifest.xml

软件的android关键配置文件

涉及安全、启动的Activty等

default.properties

API Level的设置等

proguard.cfg

代码混淆使用

界面资源和访问代码

res gen 两个字目录下的文件

res下有如下类别

 res/anim:用XML表示的基于帧的动画

 res/drawable:不同规格的图标、图片等,drawable-hdpidrawable-ldpidrawable-mdpi三个子目录

 res/layout:视图对象的XML表示

 res/values:strings, colors, styles, dimensions, arrays的XML表示

 res/xml:User-defined XML files that are compiled into a binary representation

 res/raw:Arbitrary and uncompiled files that can be added

gen res中加入的资源在gen中生成访问代码R.java

assets

数据等文件

android.content.res.AssetManager asset = Application.getAssets()这个类辅助访问

src

JAVA代码

NDK

Jniobj libs目录

Jni: 放C/C++代码

Obj/libs:是c/c++的编译obj文件和so库

在这些默认文件和目录的基础上可以加入自己的需要管理的目录或文件

相关文章
|
18天前
|
人工智能 Java 开发者
阿里出手!Java 开发者狂喜!开源 AI Agent 框架 JManus 来了,初次见面就心动~
JManus是阿里开源的Java版OpenManus,基于Spring AI Alibaba框架,助力Java开发者便捷应用AI技术。支持多Agent框架、网页配置、MCP协议及PLAN-ACT模式,可集成多模型,适配阿里云百炼平台与本地ollama。提供Docker与源码部署方式,具备无限上下文处理能力,适用于复杂AI场景。当前仍在完善模型配置等功能,欢迎参与开源共建。
585 58
阿里出手!Java 开发者狂喜!开源 AI Agent 框架 JManus 来了,初次见面就心动~
|
4月前
|
自然语言处理 前端开发 Java
JBoltAI 框架完整实操案例 在 Java 生态中快速构建大模型应用全流程实战指南
本案例基于JBoltAI框架,展示如何快速构建Java生态中的大模型应用——智能客服系统。系统面向电商平台,具备自动回答常见问题、意图识别、多轮对话理解及复杂问题转接人工等功能。采用Spring Boot+JBoltAI架构,集成向量数据库与大模型(如文心一言或通义千问)。内容涵盖需求分析、环境搭建、代码实现(知识库管理、核心服务、REST API)、前端界面开发及部署测试全流程,助你高效掌握大模型应用开发。
410 5
|
2月前
|
存储 缓存 安全
Java集合框架(二):Set接口与哈希表原理
本文深入解析Java中Set集合的工作原理及其实现机制,涵盖HashSet、LinkedHashSet和TreeSet三大实现类。从Set接口的特性出发,对比List理解去重机制,并详解哈希表原理、hashCode与equals方法的作用。进一步剖析HashSet的底层HashMap实现、LinkedHashSet的双向链表维护顺序特性,以及TreeSet基于红黑树的排序功能。文章还包含性能对比、自定义对象去重、集合运算实战和线程安全方案,帮助读者全面掌握Set的应用与选择策略。
162 23
|
1月前
|
SQL Java 数据库连接
区分iBatis与MyBatis:两个Java数据库框架的比较
总结起来:虽然从技术角度看,iBATIS已经停止更新但仍然可用;然而考虑到长期项目健康度及未来可能需求变化情况下MYBATISS无疑会是一个更佳选择因其具备良好生命周期管理机制同时也因为社区力量背书确保问题修复新特征添加速度快捷有效.
78 12
|
2月前
|
存储 缓存 安全
Java集合框架(三):Map体系与ConcurrentHashMap
本文深入解析Java中Map接口体系及其实现类,包括HashMap、ConcurrentHashMap等的工作原理与线程安全机制。内容涵盖哈希冲突解决、扩容策略、并发优化,以及不同Map实现的适用场景,助你掌握高并发编程核心技巧。
|
2月前
|
安全 Java 开发者
Java集合框架:详解Deque接口的栈操作方法全集
理解和掌握这些方法对于实现像浏览器后退功能这样的栈操作来说至关重要,它们能够帮助开发者编写既高效又稳定的应用程序。此外,在多线程环境中想保证线程安全,可以考虑使用ConcurrentLinkedDeque,它是Deque的线程安全版本,尽管它并未直接实现栈操作的方法,但是Deque的接口方法可以相对应地使用。
126 12
|
3月前
|
Java 数据库连接 数据库
Java 相关知识点总结含基础语法进阶技巧及面试重点知识
本文全面总结了Java核心知识点,涵盖基础语法、面向对象、集合框架、并发编程、网络编程及主流框架如Spring生态、MyBatis等,结合JVM原理与性能优化技巧,并通过一个学生信息管理系统的实战案例,帮助你快速掌握Java开发技能,适合Java学习与面试准备。
134 2
Java 相关知识点总结含基础语法进阶技巧及面试重点知识
|
2月前
|
存储 安全 Java
Java集合框架(一):List接口及其实现类剖析
本文深入解析Java中List集合的实现原理,涵盖ArrayList的动态数组机制、LinkedList的链表结构、Vector与Stack的线程安全性及其不推荐使用的原因,对比了不同实现的性能与适用场景,帮助开发者根据实际需求选择合适的List实现。
|
3月前
|
安全 Java 微服务
Java 最新技术和框架实操:涵盖 JDK 21 新特性与 Spring Security 6.x 安全框架搭建
本文系统整理了Java最新技术与主流框架实操内容,涵盖Java 17+新特性(如模式匹配、文本块、记录类)、Spring Boot 3微服务开发、响应式编程(WebFlux)、容器化部署(Docker+K8s)、测试与CI/CD实践,附完整代码示例和学习资源推荐,助你构建现代Java全栈开发能力。
387 0

热门文章

最新文章

  • 1
    Android实战经验之Kotlin中快速实现MVI架构
    344
  • 2
    即时通讯安全篇(一):正确地理解和使用Android端加密算法
    211
  • 3
    escrcpy:【技术党必看】Android开发,Escrcpy 让你无线投屏新体验!图形界面掌控 Android,30-120fps 超流畅!🔥
    553
  • 4
    【01】噩梦终结flutter配安卓android鸿蒙harmonyOS 以及next调试环境配鸿蒙和ios真机调试环境-flutter项目安卓环境配置-gradle-agp-ndkVersion模拟器运行真机测试环境-本地环境搭建-如何快速搭建android本地运行环境-优雅草卓伊凡-很多人在这步就被难倒了
    854
  • 5
    Cellebrite UFED 4PC 7.71 (Windows) - Android 和 iOS 移动设备取证软件
    313
  • 6
    【03】仿站技术之python技术,看完学会再也不用去购买收费工具了-修改整体页面做好安卓下载发给客户-并且开始提交网站公安备案-作为APP下载落地页文娱产品一定要备案-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    231
  • 7
    Android历史版本与APK文件结构
    739
  • 8
    【02】仿站技术之python技术,看完学会再也不用去购买收费工具了-本次找了小影-感觉页面很好看-本次是爬取vue需要用到Puppeteer库用node.js扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-优雅草卓伊凡
    246
  • 9
    【01】仿站技术之python技术,看完学会再也不用去购买收费工具了-用python扒一个app下载落地页-包括安卓android下载(简单)-ios苹果plist下载(稍微麻烦一丢丢)-客户的麻将软件需要下载落地页并且要做搜索引擎推广-本文用python语言快速开发爬取落地页下载-优雅草卓伊凡
    262
  • 10
    APP-国内主流安卓商店-应用市场-鸿蒙商店上架之必备前提·全国公安安全信息评估报告如何申请-需要安全评估报告的资料是哪些-优雅草卓伊凡全程操作
    491