`
ice.k
  • 浏览: 282849 次
  • 性别: Icon_minigender_1
  • 来自: 荷兰
社区版块
存档分类
最新评论

android questions

阅读更多
1、什么是ANR 如何避免它?

http://blog.csdn.net/Zengyangtech/archive/2010/11/21/6025671.aspx

2、什么情况会导致Force Close ?如何避免?能否捕获导致其的异常?

3、Android本身的api并未声明会抛出异常,则其在运行时有无可能抛出runtime异常,你遇到过吗?诺有的话会导致什么问题?如何解决?



4、简要解释一下activity、 intent 、intent filter、service、Broadcast、BroadcaseReceiver

http://blog.csdn.net/Zengyangtech/archive/2010/11/21/6025676.aspx


5、IntentService有何优点?

IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests  through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself  when it runs out of work.

This ‘work queue processor’ pattern is commonly used to offload tasks from an application’s main thread. The IntentService class exists to  simplify this pattern and take care of the mechanics. To use it, extend IntentService and implement onHandleIntent(Intent). IntentService  will receive the Intents, launch a worker thread, and stop the service as appropriate.

All requests are handled on a single worker thread — they may take as long as necessary (and will not block the application’s main loop), but  only one request will be processed at a time.”

IntentService 的好处

Acitivity的进程,当处理Intent的时候,会产生一个对应的Service

Android的进程处理器现在会尽可能的不kill掉你

非常容易使用

日历中IntentService的应用

public class DismissAllAlarmsService extends IntentService {

@Override public void onHandleIntent(Intent unusedIntent) {

ContentResolver resolver = getContentResolver();

...

resolver.update(uri, values, selection, null);

}

}

in AlertReceiver extends BroadcastReceiver, onReceive():  (main thread)

    Intent intent = new Intent(context, DismissAllAlarmsService.class);

    context.startService(intent);

6.根据自己的理解描述下Android数字签名

Android 数字签名
       在Android系统中,所有安装到系统的应用程序都必有一个数字证书,此数字证书用于标识应用程序的作者和在应用程序之间建立信任关系,如果一个permission的protectionLevel为signature,那么就只有那些跟该permission所在的程序拥有同一个数字证书的应用程序才能取得该权限。Android使用Java的数字证书相关的机制来给apk加盖数字证书,要理解android的数字证书,需要先了解以下数字证书的概念和java的数字证书机制。Android系统要求每一个安装进系统的应用程序都是经过数字证书签名的,数字证书的私钥则保存在程序开发者的手中。Android将数字证书用来标识应用程序的作者和在应用程序之间建立信任关系,不是用来决定最终用户可以安装哪些应用程序。这个数字证书并不需要权威的数字证书签名机构认证,它只是用来让应用程序包自我认证的。
同一个开发者的多个程序尽可能使用同一个数字证书,这可以带来以下好处。
(1)有利于程序升级,当新版程序和旧版程序的数字证书相同时,Android系统才会认为这两个程序是同一个程序的不同版本。如果新版程序和旧版程序的数字证书不相同,则Android系统认为他们是不同的程序,并产生冲突,会要求新程序更改包名。
(2)有利于程序的模块化设计和开发。Android系统允许拥有同一个数字签名的程序运行在一个进程中,Android程序会将他们视为同一个程序。所以开发者可以将自己的程序分模块开发,而用户只需要在需要的时候下载适当的模块。
(3)可以通过权限(permission)的方式在多个程序间共享数据和代码。Android提供了基于数字证书的权限赋予机制,应用程序可以和其他的程序共享概功能或者数据给那那些与自己拥有相同数字证书的程序。如果某个权限(permission)的protectionLevel是signature,则这个权限就只能授予那些跟该权限所在的包拥有同一个数字证书的程序。
在签名时,需要考虑数字证书的有效期:
(1)数字证书的有效期要包含程序的预计生命周期,一旦数字证书失效,持有改数字证书的程序将不能正常升级。
(2)如果多个程序使用同一个数字证书,则该数字证书的有效期要包含所有程序的预计生命周期。
(3)Android Market强制要求所有应用程序数字证书的有效期要持续到2033年10月22日以后。
Android数字证书包含以下几个要点:
              (1)所有的应用程序都必须有数字证书,Android系统不会安装一个没有数字证书的应用程序
              (2)Android程序包使用的数字证书可以是自签名的,不需要一个权威的数字证书机构签名认证
              (3)如果要正式发布一个Android ,必须使用一个合适的私钥生成的数字证书来给程序签名,而不能使用adt插件或者ant工具生成的调试证书来发布。
              (4)数字证书都是有有效期的,Android只是在应用程序安装的时候才会检查证书的有效期。如果程序已经安装在系统中,即使证书过期也不会影响程序的正常功能。

Android面试题

1. 请描述下Activity的生命周期。
2. 如果后台的Activity由于某原因被系统回收了,如何在被系统回收之前保存当前状态?
3. 如何将一个Activity设置成窗口的样式。(Edited by Sodino)
4. 如何退出Activity?如何安全退出已调用多个Activity的Application?
5. 请介绍下Android中常用的五种布局。
6. 请介绍下Android的数据存储方式。(Edited by Sodino)
7. 请介绍下ContentProvider是如何实现数据共享的。(Edited by Sodino)
8. 如何启用Service,如何停用Service。(Edited by Sodino)
9. 注册广播有几种方式,这些方式有何优缺点?请谈谈Android引入广播机制的用意。
10. 请解释下在单线程模型中Message、Handler、Message Queue、Looper之间的关系。
11. AIDL的全称是什么?如何工作?能处理哪些类型的数据?
12. 请解释下Android程序运行时权限与文件系统权限的区别。(Edited by Sodino)
13. 系统上安装了多种浏览器,能否指定某浏览器访问指定页面?请说明原由。
14. 有一个一维整型数组int[]data保存的是一张宽为width,高为height的图片像素值信息。请写一个算法,将该图片所有的白色不透明(0xffffffff)像素点的透明度调整为50%。
15. 你如何评价Android系统?优缺点。


1.activity的生命周期。 
http://www.pin5i.com/showtopic-android-development-component-life-cycle-1.html
2.横竖屏切换时候activity的生命周期 

总结:

1、不设置Activity的android:configChanges时,切屏会重新调用各个生命周期,切横屏时会执行一次,切竖屏时会执行两次

2、设置Activity的android:configChanges="orientation"时,切屏还是会重新调用各个生命周期,切横、竖屏时只会执行一次

3、设置Activity的android:configChanges="orientation|keyboardHidden"时,切屏不会重新调用各个生命周期,只会执行onConfigurationChanged方法


3.android中的动画有哪几类,它们的特点和区别是什么 


4.handler机制的原理 


5.说说activity,intent,service是什么关系 

6.android中线程与线程,进程与进程之间如何通信 

7.widget相对位置的完成在antivity的哪个生命周期阶段实现 

8.说说mvc模式的原理,它在android中的运用 

9.说说在android中有哪几种数据存储方式 

10.android中有哪几种解析xml的类,官方推荐哪种?以及它们的原理和区别
分享到:
评论

相关推荐

    Android Questions Upto Chapter 7.pdf

    NIIT2020年Android测试题,对你的考试用很大的帮助!NIIT的考试一向多变,题型丰富,内容复杂,需要经过NIIT的专业培训,才可以接触到这些资源。希望大家可以顺利通过考试!

    Android Interview Questions & Answers

    This document contains mostly commonly asked android interview questions. It will help you to crack android interviews.

    Android代码-Android Interview Questions

    Android Interview Questions > Android Interview Questions - Your Cheat Sheet For Android Interview We will be adding answers to the more questions on our MindOrks website. Prepared and maintained ...

    Android Interview Questions.zip

    Android Interview Questions.zip,Your Cheat Sheet For Android Interview - Android Interview Questions

    android-interview-questions.zip

    android-interview-questions

    Android-Android-Interview-Questions.zip

    Android-Android-Interview-Questions.zip,收集Android和Java相关的问题和主题,安卓系统是谷歌在2008年设计和制造的。操作系统主要写在爪哇,C和C 的核心组件。它是在linux内核之上构建的,具有安全性优势。

    Android_Frequently_Asked_Questions

    imx6 移植常见问题,包括有关OTA、wifi等等

    Introduction.to.Android.Application.Development(4th,2013.12) pdf

    Key Questions Answered in This Book 2 How This Book Is Structured 2 An Overview of Changes in This Edition 3 Development Environments Used in This Book 5 Supplementary Materials Available 6 Where to ...

    Android代码-屏蔽home按键

    As there are a lot questions about "how to disable home button in android?" on Stack Overflow, such as how to disable home button in android? Android - Is It possible to disable the click of home ...

    Android代码-android-text

    Android Text Samples These samples show how to work with ...Stack Overflow: http://stackoverflow.com/questions/tagged/android-text If you've found an error in this sample, please file an issue: https://

    Android代码-AndroidVideoCache

    Questions? License Why AndroidVideoCache? Because there is no sense to download video a lot of times while streaming! AndroidVideoCache allows to add caching support to your VideoView/MediaPlayer, ...

    Exploring Android v0.3 (英文版)

    app, but you will need to turn to other resources for answers to questions like “why do we need to do X?” or “what other options do we have than Y?”. Also, the app that you will create in this ...

    android-interview-questions,你的安卓面试备忘单-安卓面试问题.zip

    安卓面试问题-你的安卓面试备忘单

    Android代码-Android矢量地图库

    If you have any questions or problems, don't hesitate to ask our public mailing list for help. Mapsforge project uses a compact file format for fast ad-hoc rendering of OpenStreetMap data. We provide...

    Android代码-Q.careercup

    A mobile app to enjoy interview questions from popular websites like: ⦙ leetcode.com ⦙ lintcode.com ⦙ careercup.com ⦙ :bulb: Inspired by leetcode-cli, and careercup-cli. A tool to utilize your ...

    Android代码-OverScrollView

    This OverScrollView also solves the issue emerged on Android 2.3.5 distributions by Samsung, which disabled over scroll completely (http://stackoverflow.com/questions/9261911/samsung-galaxy-s2-2

    Android+开发面试题_WantIt_android_

    Android operating system interview questions pdf

    Android代码-锁屏应用。

    As there are a lot questions about "how to disable home button in android?" on Stack Overflow, such as how to disable home button in android? Android - Is It possible to disable the click of home b

    Learning.Java.by.Building.Android.Games

    Title: Learning Java by Building Android Games Author: John Horton Length: 410 pages Edition: 1 Language: English Publisher: Packt Publishing ...Appendix: Self-test Questions and Answers

    Android代码-react-native-blur

    Questions? Installation NOTE: Latest version of the package is available in npm as react-native-blur@3.0.0-alpha Install package via npm: npm install react-native-blur Link your native ...

Global site tag (gtag.js) - Google Analytics