简体   繁体   English

在Android App上切换“屏幕”

[英]Switching “Screens” on Android App

So, I will have an ArrayList of Strings. 因此,我将有一个字符串数组列表。 Each String will represent a new "screen" of questions for the user. 每个字符串将为用户代表一个新的问题“屏幕”。 Each string will be passed to the server and it will return a list of questions to be asked. 每个字符串将被传递到服务器,它将返回要询问的问题列表。 There will be a "Next" button to go to the next screen affiliated with the next string. 将有一个“下一步”按钮转到与下一个字符串相关的下一个屏幕。

My question is, how would I implement this? 我的问题是,我将如何实施? I know three options: 我知道三种选择:

  1. Start a new activity for each, and I guess I would have to pass the ArrayList to each activity through SharedPrefs or Intent. 为每个活动启动一个新活动,我想我必须通过SharedPrefs或Intent将ArrayList传递给每个活动。

  2. After the user is done with a screen, clear the current layout, and programatically fill the layout with the new questions 用户完成屏幕操作后,清除当前布局,并以编程方式用新问题填充布局

  3. Use fragments for each. 每个使用碎片。

I'm not sure what the best method is to complete this task. 我不确定完成此任务的最佳方法是什么。 Any ideas? 有任何想法吗?

我将创建一个列表视图,单击下一个按钮时更新列表视图模型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM