返回
顶部

修改密码

Passing values from one activity to another activiity in android studio

+1

-1

收藏

+1

-1

点赞0

评论0

I am fairly new to android and I am confused right now about two things that I have noticed and read online. When I start a new intent / activity, it seems that I am allowed to go back to the previous activity with the back button which means two things …

I am fairly new to android and I am confused right now about two things that I have noticed and read online. When I start a new intent / activity, it seems that I am allowed to go back to the previous activity with the back button which means two things to me.

1) The previous activity is not destroyed and kept alive somewhere or

2) it’s destroyed and every time I click the back button it creates a new intent of the previous activity

Now, here is my problem, according to all the guides I’ve seen so far, in order to send data from one activity to another activity I have to create a newintent and use the putextrafunction . My question is whether this process also works for the reverse when I want to send data from the newly created activity back to the previous activity.

Here is a portion of the relevant code :

Home screen code:

public void CreateNewCueCardSet(View view){ // Create a new page/activity when button is clicked Intent NewCueCardPage = new Intent(this, NewCueCardActivity.class); startActivity(NewCueCardPage);}

//NewCueCardActivity.class

public void createSet(View view){// this will save text input from user on the activity EditText setType = (EditText) findViewById(R.id.editText);EditText setName = (EditText) findViewById(R.id.editText2);//How do I send these 2 variable's data back to the home screen? }

I am thinking that I just create a new intent of the home screen and send it, but what if the home screen is not destroyed and kept somewhere in memory. What do I do in that case to gain access to it?

扫一扫在手机打开

评论
已有0条评论
0/150
提交
热门评论
相关推荐
Get your hands on Android Studio 1.3,handsandroid
  • AndroidStudio
  • 2022-05-20 18:29
  • 9 0 0
+1
How to Use OpenCV in Android Studio,opencvandroid
  • AndroidStudio
  • 2022-05-20 18:29
  • 11 0 0
+1
Useful Android Studio Shortcuts
  • AndroidStudio
  • 2022-05-20 18:29
  • 5 0 0
+1
Android Studio tutorial for beginners
  • AndroidStudio
  • 2022-05-20 18:29
  • 11 0 0
+1
Android Studio: Simple webview setup
  • AndroidStudio
  • 2022-05-20 18:29
  • 7 0 0
+1
今日要闻
换一批
热点排行