How to pass data from 2nd activity to 1st activity when pressed back? – android

I’ve 2 activities, Activity1 and Activity2. In Activity1 I’ve a Button and TextView. When the button is clicked Activity2 is started. In Activity2 I’ve an EditText. I want to display the data retrieved from EditText in Activity2 in the TextView in Activity1 when back is pressed from Activity2. can someone help me with the code … Read more

The specified child already has a parent. You must call removeView() on the child’s parent first (Android)

I have to switch between two layouts frequently. The error is happening in the layout posted below. When my layout is called the first time, there doesn’t occur any error and everything’s fine. When I then call a different layout (a blank one) and afterwards call my layout a second time, it throws the following … Read more