英文:
Transfer text from one activity to another
问题
我想在两个活动之间传输文本,还需要将该文本保存在本地数据库中。但它应该只在第一次时询问插入文本。请协助。
英文:
I want to transfer text from one activity to another and also need to save that text in local database. But it should ask to insert text for first time only. Please assist.
答案1
得分: 0
Sure, here's the translated code:
One Activity
Intent intent = new Intent(OneActivity.this, SecondActivity.class);
intent.putExtra("key", "value");
startActivity(intent);
Second Activity
String sessionId = getIntent().getStringExtra("key");
英文:
One Activity
Intent intent = new Intent(OneActivity.this, SeconActivity.class);
intent.putExtra("key","value");
startActivity(intent);
Second Activity
String sessionId = getIntent().getStringExtra("key");
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论