NIIT安卓复习提纲+答案Word版.doc

上传人:rrsccc 文档编号:9024508 上传时间:2021-01-30 格式:DOC 页数:10 大小:75KB
返回 下载 相关 举报
NIIT安卓复习提纲+答案Word版.doc_第1页
第1页 / 共10页
NIIT安卓复习提纲+答案Word版.doc_第2页
第2页 / 共10页
NIIT安卓复习提纲+答案Word版.doc_第3页
第3页 / 共10页
NIIT安卓复习提纲+答案Word版.doc_第4页
第4页 / 共10页
NIIT安卓复习提纲+答案Word版.doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《NIIT安卓复习提纲+答案Word版.doc》由会员分享,可在线阅读,更多相关《NIIT安卓复习提纲+答案Word版.doc(10页珍藏版)》请在三一文库上搜索。

1、传播优秀Word版文档 ,希望对您有帮助,可双击去除! 一、 基础:1.安卓核心组件有哪些?Activities、Services、Content providers、Broadcast receives2.安卓 key features 有哪些?Integrated browser、SQLite、Media support、Wireless services、DVM、Application framework、Rich development environment3.安卓用什么数据库?SQLite Database 4.几个流行的移动平台各自的 IDE 是什么?1.Symbian(Qt C

2、reator) 2.Android(EclipseAndroid Studio) 3.BlackBerry(The BlackBerry Java Development Environment (JDE) ) 4.IOS(Xode)5.Windows(Visual Studio)5.R.java 是什么文件?干什么用的?在什么地方?R.java is an index database file,store the ID of all the resource in app.R.java located in /gen directory. 6.安卓平台架构分为几层?各是什么?Android

3、 platform has a four-layered architecture:Linux kernel、Libraries and Android runtime、Application framework、Applications7.创建一个 UI 并运行之,有哪几个步骤?a. Create a new Android project;b. Design the UI ,you can use the controls in toolbox or coding in the layout.xml file; c. Associate the UI with the activity;d

4、. Register the activity.8.Intent 有几个组件?各是干什么用的?哪些组件是必须存在的,哪些是可选的,在Manifest中 intent filter 是如何声明的?Component name: Specify the name of the component that should handle the intent.Action: Specify the action that needs to be performedData: Specifies the data to operate on .Category: Specifies the behavi

5、our of the target application component.Extras: Contains extras information in the form of key-value pairs that must delivered to the components that handle the intent.Flags: Includes flags that control various aspects related to activating a new component.必须存在:Action 可选:Data、CategoryIn the Manifest

6、 file ,intent filter was defined as following:Intent filter was declared in the form of tag and the tag was contained in the tag .9.Activity的生命周期有哪些状态?状态转换时调用的方法各是什么? Running、Paused、Stopped 10.同一个应用之间Activity互相调用要用什么Intent(隐式、显式?还是什么?)? Use Explicit Intent.1)Explicit Intent(指定接收者): Explicit Intent s

7、pecify the name of the target component in order to activate that component .Such intents are used to start an activity or a service within the same application.2)Implicit Intent(不指定接收者): Implicit intents are used to activate the components of other applications. Implicit intents do not specify the

8、target component by their name ,components advertise their capability to do a job by using a intent filers.11.什么是Dalvik Virtual Machine?DVM is a running-environment for Android application which interpreted Android byte codes at runtime.12.安卓日志类 Log 有几种常用方法?各用于什么输出什么信息?哪些信息只应该在开发的时候才允许输出? The Log cl

9、ass provides five methods,such as : 1.Log.e (): used to log errors. For example:try-catch block2.Log.w (): used to log warnings.3.Log.i (): used to log informational messages such as information related to state of activities or services.4.Log.d (): used to log debug messages,which can be used for d

10、ebugging an application.5.Log.v (): used to log verbose messages.开发时输出:debug message and verbose message 二、核心机制:1.什么是Content Provider Content Provider can help application access storage locations,it also can store and retrieve data making the data can be accessed to all applications.2.什么是Broadcast

11、ReceiverA broadcast receiver is a component of an application that responds to system-wide broadcast announcements.3.什么是IntentIntents are messages used to activate application components such as ,activities,services,and broadcast receivers.4.什么是Service,Service有哪些状态?An Android service is an applicati

12、on component that does not provide any user interface and keeps running in the background.started and bound5.安卓的资源有哪些类型?各放在什么位置?Animation Resources 文件位置:res/anim/ or res/drawable Color State List Resource 文件位置:res/color/Drawable Resource 文件位置:res/drawable/Layout Resource文件位置:res/layout/Menu Resource

13、文件位置:res/menu/String Resource文件位置:res/values/Style Resource 文件位置:res/values/More Resource Types文件位置:res/values/6.IPC是什么意思?和Intent有什么关系?IPC(Inter-process Communication)Intent is one of type IPC.7.Broadcast有哪几种?区别? Normal Broadcasts 、Ordered BroadcastsNormal Broadcasts: broadcasts are sent to all inte

14、rested receivers at the same time and the receivers run in an undefined order often at the same time.Ordered Broadcasts: broadcast are sent to all interested receives in a proper order.8.Ordered broadcast如何决定接收者的顺序?Ordered broadcast decide the receive order by receivers priority.9.安卓中的 Permissions,包

15、括怎么向系统申请权限,怎么用权限保护自己等If an application needs to access a restricted resource/component, it need to declare the required permission in the applications manifest file by using the tag;If you want to protect an application ,you can use the tag in your manifest file; 三、IO:1.安卓原生支持几种IO机制?各自有什么特点?1.SQLite

16、 Database: SQLite is that an open-source ,standard-compliant,lightweight and single-tier RDBMS.2.Internal storage: The data be stored is very small and can be stored in files instead of a database; 3.External storage: It provide a large capacity that allow user to store large files;4.Shared Preferen

17、ce: It used to customize applications in the form of a framework that allows you to retrieve persistent key-value pairs of built-in data types;5.remote location: It can extracts current data(updated frequently) from the Web and sends it to the application that requests the data;2.安卓原生的content provid

18、er有哪些?1.Browser、2.Contacts、3.Call log 、4.Media store、5.Setting3.如何创建一个content provider?1)Create a custom content provider;2) Specify the URI of a content provider;3) Implement query handling methods;4) Access the data exposed by a content provider;5) Handle requests for the MIME type of data;6) Regi

19、ster a custom content provider. 4.安卓下访问一个文件,要写到文件最后,要用什么模式打开文件?Use the File Creation Modes: MODE_APPEND The mode creates a file if it does not exist.However,if it exists,any content added to the file is appended at the end of the existing file.5.判断SD卡是否可用,用什么方法?If(Environment.MEDIA_MOUNTED.equals(En

20、viroment.getExternalStorageState()6.Shared Preferences 是什么?有什么用?1)Shared preferences are a lightweight mechanism used to store key-value pairs of primitive data types.2) Shared Preference are an ideal preferences.They are most frequently used to persist data across user sessions and to share setting

21、s between application components.7.要从远端URL播放多媒体文件用什么stream? HTTP stream8.创建一个安卓数据库都有哪些途径?1) Creating a database programmatically;2)Creating a database through shell commands. 四、UI:1.安卓有哪些常见的布局管理器(Layout)?各有什么特点?1.Linear layout: The linear layout allows you to arranges widgets in a single row; 2.Tabl

22、e layout: This layout arranges its child views in rows and columns; 3.Frame layout: This layout is used to add views in a stack format, one item over another; 4.Relative layout: In this layout, views are positions relatively to their neighbors or parents.5.Absolute layout: This layout allow you to s

23、pecify the exact position of views on a layout.2.按下button,被调用的回调函数是什么? onClick()3.安卓内建的theme有哪些?1)Theme.Black2) Theme.Light3) Theme.Translucent4) Theme.Dialog5) Theme.Holo4.各种对话框共同的父类是是什么?The Dialog class acts as the base class of for creating all dialogs.5.View类是什么?起什么作用?Answer: The view class is t

24、he basic building block of an Android applications UI and the parent of all widgets. Views are graphical representations of components and enable event handling on components.6.Options Menu是什么?Context Menu是什么?1)Options Menu is the primary collection of menu items for an activity, which appears when

25、the user presses the MENU button on the emulator/device.2) Context Menu is a floating list of menu items that appears when user touches and holds a view that is registered to provide a context menu.7.Android 原生支持哪几种 Dialog?1)AlertDialog2) ProcessDialog3) DatePickerDialog4) TimePickerDialog8.安卓画图相关的主

26、要有哪3个类?各自作用?1)Canvas: A Canvas represents a surface where you can draw shapes and images;2) Paint: The Paint class in Android provides information about the style and color for drawing symbols, text, and graphics;3) Bitmap :A bitmap image uses pixels to create graphics.9.复合控件(compound views)是什么?Comp

27、ound views refer to combining multiple views into a logical group of items that can be treated as a single view.五、Tools:1.ADB是什么?ADB工具一般放在什么位置?ADB(Android Debug Bridge)is a debug tool ,which is a versatile command line tool that allows to communicate with an emulator instance or connect Android-enab

28、led mobile device.一般放在:/platform-tools/folder2.安卓开发环境包括哪些东西?The Android development environment include IDE and Android SDK.3.安卓应用程序有哪些类型?Foreground app、Background app、Intermittent app 、Small component4. 和 是什么?各自干什么用的?1) is a tag which used to declare permission to access a restricted resource/compo

29、nent of another application;2) element is used to state all the features of a device that used by your application.5.adb是什么?有什么用?adb is a command .It used to interact with Android emulator directly from the command line or from the script. 六、 其他:1.周期性Alarm用什么方法创建?Create a repeating alarm need to use

30、 the setRepeating() method of the AlarmManager class. 2.安卓支持哪几种Location Provider?如何获得位置提供者,具体方法类有哪些?GPS、Cell tower triangulation 、Public wi-fi hotspotsAndroid uses the LocationManager class and the getProvider() method to find the name of all the location providers that are available on the mobile d

31、evice.3.安卓收到一个短信,会触发什么样的broadcast?When an SMS is received by an Android system,it triggers a broadcast with action as SMS_RECEIVED,which notifies all the receivers that an SMS has been received.4.什么是ADT-Plugin?ADT-Plugin is a plug-in for eclipse that allows you to create and debug the android applic

32、ation quickly and easily七、情景编程:(给出清晰的概念、思路、过程既可,不要求精确代码) 1.发送短信,拨叫某个号码(可以是直接拨叫、也可以是启动拨号面板,不考虑权限问题)Answer: 1.Send and receive an SMS1、发送 SMS,代码要做3件事情:1)获取 SmsManager:SmsManager smsM = SmsManager.getDefault(); / static2)申请权限:3)发送:smsM.sendTextMessage(String dstAddr, / 对方手机号, e.g. 139139139139String sm

33、sc, / SMSC(Short Message Service Center) 地址,null取默认String txt, / 内容PendingIntent sent, / 发出后广播的消息(可能为 OK, 可能为 Fail)PendingIntent deliver); / 对方收到后广播的消息要接收 sent 消息:PendingIntent in = getBroadcast(Context c, int reqtCode, / 未用Intent i, / sent 本身int flags) / demo2.拨号:1、Making Telephonic CallsIntent int

34、ent = new Intent(Intent.ACTION_DIAL, Uri.parse(tel:5623451) );ACTION_CALL / 直接拨号, 须权限ACTION_DIAL / 仅打开拨号面板, 无须权限startActivity(intent);2.如何从内部、外部(SD卡)存储器存取文件Answer:1)Internal Data Storage:To create a file on the internal storage for writing data:1. Open or create the file by using the openFileOutput(

35、) method of the android.content.Context class;2. Write data to the file by using the write() method of java.io.FileOutputStream class;3. Close the file by using the close() method of java.io.FileOutputStream class.String FILENAME=”Mydata.txt”;String mydata=”My name is Sam”;FileOutputStream fos = ope

36、nFileOutput(FILENAME,Context.MODE_PRIVATE);Fos.write(myData.getBytes();Fos.close();To open file from the internal storage for reading data:1.Open or create the file by using the openFileIntput() method of the android.content.Context class;2.Write data to the file by using the read() method of java.i

37、o.FileIntputStream class;3.Close the file by using the close() method of java.io.FileIntputStream class.String FILENAME=”Mydata.txt”;FileInputStream fis = openFileInput(FILENAME);byte reader = new bytefis.available();if (fis.read(reader)!= -1)String myData = new String(reader);Fis.close();2) Externa

38、l Data Storage:申请权限 String MYFILE = “MyData.txt”;String myData = “My name is Sam”FileOutputStream fos = new FileOutputStream(Environment.getExternalStorageDirectory()+“/”+MYFILE):byte reader = new bytefis.available();fos.write(myData.getBytes();Fos.close();FileInputStream fis - new FileInputStream(E

39、nvironment.getExternalStorageDirectory()+“/”+MYFILE);Byte reader = new bytefis.avilablea();While(fis.read(reader)!= -1) String mData = (new String(reader);Fis.close();3.如何获取当前地理位置.a.申请权限b.获取LocationManger LocationManger lm=(LocationManger)getSystemService(Context.LOATION_SERVICE);c.选择一个providerd.获取l

40、ocation Location location = lm.getCurrentLocation(provider);4.如何显示一个Status Bar Notification.Step1:获取 NotificationManager实例String serviceName = Context.NOTIFICATION_SERVICE;NotificationManager nm = (NotificationManager)getSystemService(serviceName);Step2:创建 Notification 对象:/The message to be shown on

41、 the status barString msg = Notification msg;long when= System.currentTimeMillis(); int icon = R.drawable.icon;Notification notification = new Notification(icon, msg, when);Step3:设置拉出 notification window 后显示的内容setLatestEventInfo(Context con, CharSequence title, CharSequence text, PendingIntent i);5.

42、如何播放res/raw/abc.mp3.MediaPlayer mediaplayer = MediaPlayer.create(context,R.raw.abc.mp3);Mediaplayer.start();6.如何打开一个contact with ID 3.Answer:ContentResolver cr = getContentResolver();Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI,null,”DISPLAY_NAME = ”+ name” “,null,null);if(cusor.mo

43、veToFirst()String contactID = 3;String contactName = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISP LAY_NAME);7.如何找到一个ID为tabHost的ViewAnswer: View mView = (View)findViewById(R.id.tabHost);8.如何点按一个Button后,让某个TextView内容发生变化。private Button btn;private TextView tv;btn = (Button)findViewById(R.id.button1); tv = (TextView)findViewById(R.id.textView1); btn.setOnClickListener(new View.OnClickListener() Over

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1