android test review

来源:互联网 发布:如何判断淘宝号被黑 编辑:程序博客网 时间:2024/05/19 14:17
  1. Which of the following is not Content Provider?

    • answer: Shared Preferences
    • Android系统一共提供了四种数据存储方式。分别是:SharePreference、SQLite、Content Provider和File。
  2. Which of the following statements are correct with regards to signing applications?

    • No certificate authority is needed.
    • Android requires that all apps be digitally signed with a certificate before they can be installed. You can use self-signed certificates to sign your applications. No certificate authority is needed.
    • When you are ready to release your application to users, you must sign it with a suitable private key on your own. You cannot publish an application that is signed with the debug key generated by the SDK tools.
  3. Which of the following is correct to use for data transfer regularly and efficiently, but not instantaneously?

    • answer: Sync adapters
    • 如果我们的应用从服务器传输数据,且服务器的数据会频繁地发生变化,那么可以使用一个 Sync Adapter 通过下载数据来响应服务端数据的变化。要运行 Sync Adapter,我们需要让服务端向应用的 BroadcastReceiver 发送一条特殊的消息。为了响应这条消息,可以调用 ContentResolver.requestSync() 方法,向 Sync Adapter 框架发出信号,让它运行 Sync Adapter。
  4. What is the best way of opening camera as sub-activity?

    static final int REQUEST_IMAGE_CAPTURE = 1;private void dispatchTakePictureIntent() {Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);if (takePictureIntent.resolveActivity(getPackageManager()) != null) {    startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);}}
  5. What is the correct way to restrict app visibility on Google Play to devices that have a camera?

    • uses-feature android:name=”android.hardware.camera” android:required=”true” />
    • 如果某个特性被显式声明为必需的,则 Google Play 会把该特性加入应用程序的需求列表中。 然后,它会在不支持该特性的用户设备上滤除这些应用程序。 例如:
  6. Which of the following permissions and configurations must be added in manifest file for implementing GCM Client?

    • permission.C2D_MESSAGE must
    • com.google.android.c2dm.permission.SEND must
    • GcmListenerService
    • InstanceIDListenerService
    • android.permission.WAKE_LOCK optional
    • android:minSdkVersion=”8”
    • android.permission.GET_ACCOUNTS optinal
      It uses an existing connection for Google services. For pre-3.0 devices, this requires users to set up their Google account on their mobile devices. A Google account is not a requirement on devices running Android 4.0.4 or higher.
  7. What is the advantage of using AsyncTaskLoader instead of AsyncTask?
    • less work with the configuration of application
    • AsyncTaskLoader不需要写代码来处理activiy 配置(系统字体大小,orientation,输入设备类型等都叫做activity的配置)变化带来的影响,但是缺点是加载时候不能解散掉进度框,不能在onLoadFinished时切换fragment.单纯的从load data 角度考虑,AsyncTaskLoader更合适。
    • If you need UI changes after data is loaded - AsyncTask might server you better, especially if you are working with fragments, but remember to handle activity configuration changes.
    • AsyncTaskLoader是基于AsyncTask的 ,他不仅可以异步(通俗理解就是又开了一个线程而已),并且当他检测到数据的变化时会自动加载。
  8. Which of the following statements are correct with regards to running of the Sync Adapter?

    • Running sync adapter periodically by setting a period of time to wait between runs, or by running it at certain times of the day, or both.
  9. Which of the following protocols are provided by Google for GCM Connection Servers?

    • Currently GCM provides two connection server protocols: HTTP and XMPP. Your app server can use them separately or in tandem.
  10. Which of the following 4 classes does not relate to others?
    • ApplicationInfo :Information you can retrieve about a particular application. This corresponds to information collected from the AndroidManifest.xml’s application tag.
    • SyncInfo: Information about the sync operation that is currently underway.
    • ActivityInfo: Information you can retrieve about a particular application activity or receiver. This corresponds to information collected from the AndroidManifest.xml’s activity> and receiver> tags.
    • PackageInfo: Overall information about the contents of a package. This corresponds to all of the information collected from AndroidManifest.xml.
  11. Which of the following classes is not used in working with database?

    • SQLiteOpenHelper: 可以创建数据库,和管理数据库的版本。
    • SQLiteDatabase: Exposes methods to manage a SQLite database. SQLiteDatabase has methods to create, delete, execute SQL commands, and perform other common database management tasks.
    • ContentProvider
    • DatabaseHelper: doesn`t exist
  12. Which of the following statement is correct regarding StrictMode?

    • StrictMode detects improper layouts
    • StrictMode detects operation which blocks UI
    • StrictMode detects the speed of the connection
    • StrictMode最常用来捕捉应用程序的主线程,它将报告与线程及虚拟机相关的策略违例。一旦检测到策略违例(policy violation),你将获得警告,其包含了一个栈trace显示你的应用在何处发生违例。除了主线程,我们还可以在Handler,AsyncTask,AsyncQueryHandler,IntentService等API中使用StrictMode。
  13. MediaPlayer mp = new MediaPlayer(); before mp.start();

    • A MediaPlayer object must first enter the Prepared state before playback can be started.
    • There are two ways (synchronous vs. asynchronous) that the Prepared state can be reached: either a call to prepare() (synchronous) which transfers the object to the Prepared state once the method call returns, or a call to prepareAsync() (asynchronous) which first transfers the object to the Preparing state after the call returns (which occurs almost right way) while the internal player engine continues working on the rest of preparation work until the preparation work completes. When the preparation completes or when prepare() call returns, the internal player engine then calls a user supplied callback method, onPrepared() of the OnPreparedListener interface, if an OnPreparedListener is registered beforehand via
  14. if (intent.action == Intent.CALL_ACTION)

    • answer: When an outgoing phone call is initiated on the device.
    • 很多的时候 DIAL_ACTION 打开 Andriod拨号盘,
    • CALL_ACTION 将会启动电话的呼叫过程并且开始呼叫提供的号码
  15. Which of the following are true about enabling/disabling menu items from an Activity class?

    • answer: onPrepareOptionsMenu can be used to enable/disable some menu items in an Android application.
    • Once the activity is created, the onCreateOptionsMenu() method is called only once
    • If you want to change the Options Menu any time after it’s first created, you must override the onPrepareOptionsMenu() method. This passes you the Menu object as it currently exists. This is useful if you’d like to remove, add, disable, or enable menu items depending on the current state of your application.
  16. SimpleAdapter

    • An easy adapter to map static data to views defined in an XML file. You can specify the data backing the list as an ArrayList of Maps. Each entry in the ArrayList corresponds to one row in the list.
  17. SimpleCursorAdapter

    • An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file.
      String sql = "select _id,name,age from test_table";    //得到一个Cursor,这个将要放入适配器中Cursor cursor = dbManager.executeSql(sql, null);    // 最后一个参数flags是一个标识,标识当数据改变调用onContentChanged()的时候,是否通知ContentProvider数据的改变,如果无需监听ContentProvider的改变,则可以传0。SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.item, cursor, new String[] { "name", "age" }, new int[] { R.id.name, R.id.age }, 0);        ListView listView = (ListView) findViewById(R.id.listView);listView.setAdapter(adapter);
  18. Which of the following are true about PhoneStateIntentReceiver.notifyPhoneCallState?

  19. How many expansion files can an APK file have? Select all correct options.

    • You can store two expansion files per application. Each expansion file can be up to 2GB in size. APK files have a maximum file size, based on the Android …
  20. store custom message codes about the Message?

    • what: User-defined message code so that the recipient can identify what this message is about.
  21. markup

    • HTML is basically the web’s standard mark-up language, but it’s rather verbose.
    • Markdown is a specific markup library: http://daringfireball.net/projects/markdown/
    • What is the interface Spannable used for?
    • This is the interface for text to which markup objects can be attached and detached.
  22. PackageManager.getPackageInfo() returns information about the package, and PackageInfo.applicationInfo field has required information about the application.

  23. Which of the following attributes in the manifest file defines version information of an application for the Google Play Store (as opposed to defining version information for display to users)?

    • Google为APK定义了两个属性:VersionCode和VersionName,他们有不同的用途。
    • VersionCode:对消费者不可见,仅用于应用市场、程序内部识别版本,判断新旧等用途。
    • VersionName:展示给消费者,消费者会通过它认知自己安装的版本,下文提到的版本号都是说VersionName。
  24. select the two function calls that can be used to start a service from your android application?

    • BindService和Started Service都是Service,有什么地方不一样呢:
    • Started Service中使用StartService()方法来进行方法的调用,调用者和服务之间没有联系,即使调用者退出了,服务依然在进行【onCreate()- >onStartCommand()->startService()->onDestroy()】,注意其中没有onStart(),主要是被onStartCommand()方法给取代了,onStart方法不推荐使用了。
    • BindService中使用bindService()方法来绑定服务,调用者和绑定者绑在一起,调用者一旦退出服务也就终止了【onCreate()->onBind()->onUnbind()->onDestroy()】。
  25. which of the following are valid features that you can request using requestwindowfeature?
    • FEATURE_NO_TITLE
    • FEATURE_RIGHT_ICON
0 0
原创粉丝点击