Android的:如何从活动使用意图调用片段类 [英] Android: How to call Fragment class from activity using Intent

查看:115
本文介绍了Android的:如何从活动使用意图调用片段类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调用从活动使用意图片段类。是否有可能实现。请提供您的意见。

I am trying to call a Fragment class from Activity using Intent. Is it possible to implement. Please provide your views.

推荐答案

片段需要举办一个 FragmentActivity ,你可以做一个意图来从活动调用片段。

Fragment needs to be hosting by a FragmentActivity, you can make a Intent to call a fragment from an Activity.

您需要创建一个 FragmentManager 添加您的片段在 FragmentActivity (或调用另一个 FragmentActivity 通过意图并添加您的片段就可以了)。
有关更多信息,请参见本主题:添加一个片段的活动在运行时

You need to create a FragmentManager to add your fragment in a FragmentActivity (or call another FragmentActivity via an Intent and add your fragment on it).
See this topic for more information: Add a Fragment to an Activity at Runtime.

这篇关于Android的:如何从活动使用意图调用片段类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆