当前位置: 编程技术>移动开发
本页文章导读:
▪PackageManager->resolveActivity查询是不是有符合条件的Activity PackageManager-->resolveActivity查询是否有符合条件的Activity
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.parse(url), mimetype);
if (getPackageManager().resolveActivity(intent,
.........
▪ 创设指南针View的例子(2) 创建指南针View的例子(2)
7. 为了查看指南针,修改main.xml资源,使用你的CompassView来替换TextView。这个过程将在下个章节中有更加详细的解释。
<?xml version=”1.0” encoding=”utf-8”?>
&l.........
▪ 全屏幕展示 全屏幕显示
在onCreate方法中的第一句加上
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 即可全屏,可以跟隐藏标题一起使用。
......
[1]PackageManager->resolveActivity查询是不是有符合条件的Activity
来源: 互联网 发布时间: 2014-02-18
PackageManager-->resolveActivity查询是否有符合条件的Activity
查询是否有符合Uri.parse(url), mimetype这两个条件的Activity
public abstract ResolveInfo resolveActivity (Intent intent, int flags)
Since: API Level 1
Determine the best action to perform for a given Intent. This is how resolveActivity(PackageManager) finds an activity if a class has not been explicitly specified.
Parameters
intent An intent containing all of the desired specification (action, data, type, category, and/or component).
flags Additional option flags. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the CATEGORY_DEFAULT.
Returns
Returns a ResolveInfo containing the final activity intent that was determined to be the best action. Returns null if no matching activity was found.
See Also
MATCH_DEFAULT_ONLY
GET_INTENT_FILTERS
GET_RESOLVED_FILTER
resolveContentProvider和resolveService的作用一样。
Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url), mimetype); if (getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY) != null) { // someone knows how to handle this mime type with this scheme, don't download. try { startActivity(intent); return; } catch (ActivityNotFoundException ex) { if (Config.LOGD) { Log.d(LOGTAG, "activity not found for " + mimetype + " over " + Uri.parse(url).getScheme(), ex); } }
查询是否有符合Uri.parse(url), mimetype这两个条件的Activity
public abstract ResolveInfo resolveActivity (Intent intent, int flags)
Since: API Level 1
Determine the best action to perform for a given Intent. This is how resolveActivity(PackageManager) finds an activity if a class has not been explicitly specified.
Parameters
intent An intent containing all of the desired specification (action, data, type, category, and/or component).
flags Additional option flags. The most important is MATCH_DEFAULT_ONLY, to limit the resolution to only those activities that support the CATEGORY_DEFAULT.
Returns
Returns a ResolveInfo containing the final activity intent that was determined to be the best action. Returns null if no matching activity was found.
See Also
MATCH_DEFAULT_ONLY
GET_INTENT_FILTERS
GET_RESOLVED_FILTER
resolveContentProvider和resolveService的作用一样。
[2] 创设指南针View的例子(2)
来源: 互联网 发布时间: 2014-02-18
创建指南针View的例子(2)
Sample Code:
http://files.cnblogs.com/xirihanlin/DL090723@cc-CompassView.zip
Sample图示:
7. 为了查看指南针,修改main.xml资源,使用你的CompassView来替换TextView。这个过程将在下个章节中有更加详细的解释。
<?xml version=”1.0” encoding=”utf-8”?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
<com.paad.compass.CompassView
android:id=”@+id/compassView”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”
/>
</LinearLayout>
8. 运行Activity,你会看到指南针显示出来了。第10章中,你将了解如何绑定CompassView到设备的指南针。
Sample Code:
http://files.cnblogs.com/xirihanlin/DL090723@cc-CompassView.zip
Sample图示:
[3] 全屏幕展示
来源: 互联网 发布时间: 2014-02-18
全屏幕显示
在onCreate方法中的第一句加上
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN); 即可全屏,可以跟隐藏标题一起使用。
最新技术文章: