简体   繁体   English

是否可以在不使用 Intent 的情况下将 Edittext 值从一个活动传递到另一个活动

[英]Is it Possible to Pass Edittext Value from one activity to another activity without using Intent

Intent intent = new Intent(this, Page.class); 
intent.putExtra("arg", getText);
startActivity(intent);


//second activity:

String passedArg = getIntent().getExtras().getString("arg");
enteredValue.setText(passedArg);

To get value from one activity to another activity without using intents....??在不使用意图的情况下从一项活动获得另一项活动的价值....?? I want to show edittext passed data in other activity edittext but without using intent...??我想在其他活动edittext中显示edittext传递的数据但不使用意图......? Kindly help me is it possible or not....??请帮助我是否可能....??

There are many ways: event buses, SharedPreferences, through global object (application class), database, simple file.有很多方法:事件总线、SharedPreferences、通过全局对象(应用程序类)、数据库、简单文件。 But why?但为什么?

Try direct and readable style first.首先尝试直接和可读的风格。

if you can't bundle the values you want to save in the Intent, then you could use the SharedPreferences .如果您无法将要保存在 Intent 中的值捆绑在一起,则可以使用SharedPreferences More information here更多信息在这里

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

相关问题 将 Intent 从一个活动传递到另一个活动 - Pass Intent from one activity to another activity 如何在不使用Intent的情况下将对象从一个活动传递到另一个活动 - How to pass object from one activity to another activity without using Intent 如何将动作栏中的edittext值从一个活动传递到另一个活动? - how to pass edittext value in actionbar from one activity to another? 将ListView中的EditText值传递给另一个Activity - Pass EditText value from ListView to another Activity 使用Intent将对象从一个活动传递到另一个活动时会出现什么问题 - What are the problems in using Intent to pass objects from one activity to another 无法将值从意图传递给另一个活动 - Cannot Pass the Value from Intent to another activity 将价值从一个活动传递到另一个活动 - pass value from one activity to another activity 使用意图将价值从一项活动传递到另一项活动 - Passing value from one activity to another using intent 如何使用Xamarin在Android中通过意图将列表从一个活动传递到另一个活动 - How to pass List via intent from one activity to another activity in android using xamarin 如何传递ArrayList <File> 对象从一个活动到另一个活动使用意图? - How to pass ArrayList<File> object from one Activity to another Activity using Intent?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM