如何在不同活动中的片段之间发送数据 [英] How to send data between fragments in different activities

查看:61
本文介绍了如何在不同活动中的片段之间发送数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在infoSec中工作了近十年,现在我正尝试着手转向Android开发.我是Android领域的新手.这个问题以前可能已经回答过,但是我没有找到任何使用图片的人.所以我们开始:

I've been working in infoSec for almost a decade and now I'm trying to pivot into Android development. I'm completely new in the field of Android. This question has probably been answered before, but I didn't find anyone using pictures. So here we go:

我想通过片段和活动来掌握这件事.活动和片段图像

I want to grasp this thing with Fragments and activities. Activities and fragments image

基本上,我想做一件简单的事情;从GameFragment获取结果,将其传递给GameActivity,将其传递给ResultActivity,然后将其显示在结果片段中.(或者,如果还有另一种方式可以与不同活动中的片段进行通信)

Basically I want to do a simple thing; get the result from GameFragment, pass it to GameActivity, pass it to ResultActivity, and then show it in the result fragment. (Or if there is another way to communicate with fragments in different activities)

推荐答案

是的,我下面提到了很多方法:

Yes there is many way below i mention :

  1. 您可以使用共享首选项.

您可以使用 sqlite.

您可以使用意图传递数据.

链接将提供有关此主题的简要知识.

Links will provide brief knowledge about this topics.

这篇关于如何在不同活动中的片段之间发送数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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