这是情况:
我想通过隐式意图打开另一个应用程序,但用户没有足够的应用程序.我可以为他打开"Google Play搜索活动",其结果包括包含能够提供此类意图的组件的应用程序(具有适当的意图过滤器).换句话说,您可以使用"意图数据"执行搜索吗?
在阅读有关 Widgets 的 Android 文档时,我偶然发现了这段代码,其目的是启动一项服务以检索 StackView 项目的工厂。
// Set up the intent that starts the StackViewService, which will
// provide the views for this collection.
Intent intent = new Intent(context, StackWidgetService.class);
// Add the app widget ID to the intent extras.
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetIds[i]);
intent.setData(Uri.parse(intent.toUri(Intent.URI_INTENT_SCHEME)));
// Instantiate the RemoteViews object for the App Widget layout.
RemoteViews rv = new RemoteViews(context.getPackageName(), R.layout.widget_layout);
// Set up the RemoteViews object to use a RemoteViews adapter.
// This adapter connects
// to a RemoteViewsService through …Run Code Online (Sandbox Code Playgroud)