多个oncreate?方法 [英] Multiple oncreate? methods

查看:165
本文介绍了多个oncreate?方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,该应用程序从我希望库存阵列进入的主屏幕上启动.有一个按钮可将您带到另一个屏幕,并允许您输入信息并创建项目对象.当我单击添加按钮ID时,它会通过意图将商品发送回主屏幕,并将其添加到库存中.或者,也可以单击后退"按钮并返回到没有任何项目的主屏幕.

我感到困惑的是主屏幕何时显示:
a)首次发布
b)如果有需要从添加按钮开始添加的项目
c)仅重新启动而不重新初始化我的数组

Basically the app starts on the main screen where i want the inventory array to be. there is a button that takes you to another screen and allows you to enter information and create an item object. When I click the add button id like to send the item back to the main screen via intent and have it add it to the inventory. Or alternatively click the back button and return to the main screen with no item.

Where i''m confused is how the main screen know when its being:
a) Launched for the first time
b) if there is an item to add from being started by the add button
c) to just relaunch and not reinitialize my array

推荐答案

您的问题不是很清楚.但是我怀疑您想在不同的意图之间传递信息.您可以使用可拆分类 [意图类 [
Your question is not very clear. However I suspect you want to pass information between different intents. You can do this by using the Parcelable class[^], or the putxxxExtra and getxxxExtra methods of the Intent class[^].


这篇关于多个oncreate?方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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