Android面试练习|Android面试练习 01

1、R.id.textview1(textview1为xml下TextView的id)类型是什么?
答案:int类型
2、Intent intent = new Intent(Intent.ACTION.VIEW,Uri.parse("http://mail.google.com"))这句话作用陈述正确的是( ).

A 发送Email B 在浏览器浏览这个网址 C 发送短信 D 其它项不正确

答案:
B
Intent.ACTION_VIEWString android.intent.action.VIEW 用于显示用户的数据。比较通用,会根据用户的数据类型打开相应的Activity。 比如 tel:13400010001打开拨号程序,http://www.g.cn则会打开浏览器等。代码:Uri uri = Uri.parse("http://www.google.com"); //浏览器(网址必须带http) //Uri uri =Uri.parse("tel:1232333"); //拨号程序 //Uri uri=Uri.parse("geo:39.899533,116.036476"); //打开地图定位 Intent it= new Intent(Intent.ACTION_VIEW,uri); //Intent.ACTION_VIEW不带引号 startActivity(it);

3、关于BroadcastReceiver的说法不正确的是
A 是用来接收广播Intent的B 广播Intent只能被一个订阅了此广播的BroadcastReceiver所接收C 对有序广播,系统会根据接收者声明的优先级别按顺序逐个执行接收者D 接收者声明的优先级别在的android:priority属性中声明,数值越大优先级别越高

【Android面试练习|Android面试练习 01】正确答案: B
A Base class for code that will receive intents sent by sendBroadcast(). API第一句话就说明了,用来接收广播发过来的Intent; 所以A正确B 明显错误,广播可以被订阅了该广播的所有接受者接收。C The order receivers run in can be controlled with the android:priority attribute of the matching intent-filter; receivers with the same priority will be run in an arbitrary order.按照优先级别来执行。所以C正确D Specify the relative importance or ability in handling a particular Intent. 正确 综合上述:ACD正确,错误的当然是B

    推荐阅读