Intent have abstract description from the operation. Intent can used with startAtivity for calling new activity, broadcastIntent from send broadcastReceiver and startService or bindService for communicate with background service.
Prepared 2 xml layout :
The xml code for activity_main.xml, look likes this :
For activity_second.xml, look likes this :
After we created the layout, now modify our java classes. Create an onClick for the button that we used to calling new activity. The code of MainActivity.java, like the following :
Modify your SecondActivity.java, like the following code :
To back to the previous page by using a button (not button back on your phone) just write onBackPressed() inside your onClick.
onBackPressed() is a default method that used to back to the previous ActivityOk, that's all