---
title: "Android面试题"
author: "peng4602"
date: "2021-02-21T19:54:16Z"
tags: []
categories: ["移动开发"]
slug: "android"
draft: false
lastmod: "2021-02-21T19:54:15Z"
id: 2519239
url: "https://peng4602.iteye.com/blog/2519239"
---

1.activity的生命周期，app对意外杀死的时候。

**Situation1：**

正常启动: onCreate()  →   onStart()  →  onResume();

返回健退出: onPause()  →   onStop()  →   onDestory();

**Situation2:**

正常启动 : onCreate()  →   onStart   →  () onResume();

按home健: onPause()  →   onStop();

正常启动：onRestart()  →   onStart()   →  onResume();

**Situation3:**

正常启动：onCreate()   →   onStart()   →   onResume();

横竖屏切换： onPause()  →   onStop()   →  onDestory()   →   onCreate()   →  onStart()  →   onResume();

**Situation4:**

前提条件：Activity的AndroidManifest.xml中设置android:configChanges="orientation|keyboardHidden|screenSize”

正常启动：onCreate()   →   onStart()   →  onResume();

横竖屏切换： onConfigurationChanged();

2.activity的启动模式有四种 stand singletop singletask singleinstance

3.intent的显示调用和隐式调用

4.下载一个图片，并在页面上显示下载进度。有几种实现方式。

4.1.asynctask ，3个参数&lt;Params, Progress, Result&gt;，四个方法：doInBackground(Params...) publishProgress(Progress...) onProgressUpdate(Progress...) onPostExecute(Result)

4.2 handler message message=message.obtain（）用message.setMessage(message)发送消息**或者**message=message.obtain（handler）新生成一个messsage，用message.sendtarget();发送消息  **或者** 

**5.在多线程情况下的单例怎么写？**

**6.volatile的作用synchronized的作用**

**7.说一下你对Looper的理解 messagequeue**

**8.art中运行时数据区有哪些，GC算法有哪些**