简体   繁体   English

当我执行意图时,Textview 的内容被删除(Android Studio)

[英]Content of Textview is deleten when i execute the intent(Android Studio)

For example i have an app to make a shopping list.First activity shows the content of the list.Second one is to add items to the list and it has textviews and button.I used textviews to add items to the list.If you click any textview, related item is added to the shopping list.But you need to click the button to go without adding anything.And i am using an intent for this but if i click that button everything i added the list earlier is deleted.What is the problem and solution(s)?ty例如,我有一个应用程序来制作购物清单。第一个活动显示列表的内容。第二个活动是将项目添加到列表中,它具有文本视图和按钮。我使用文本视图将项目添加到列表中。如果单击任何 textview,相关项目已添加到购物清单中。但是您需要单击 go 的按钮而不添加任何内容。我为此使用了一个意图,但是如果我单击该按钮,我之前添加的所有列表都将被删除。什么是问题和解决方案?ty

Pls add code.. however I think the problem can be solved if you need to pass all the data to the 2nd activity and rcv the intent...and when you set the onclick listener for the button in 2nd activity...all data need to be passed back with the intent and set on the list.请添加代码..但是我认为如果您需要将所有数据传递给第二个活动并 rcv 意图...并且当您为第二个活动中的按钮设置 onclick 侦听器时,问题可以解决...所有数据需要带着意图传回并设置在列表中。

If you add the code it will help如果您添加代码,它将有所帮助

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

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