public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listen();
}
public void listen() {
Toast a = Toast.makeText(MainActivity.this,"HI",Toast.LENGTH_SHORT);
a.show();
}
}
Will this goes on printing the HI string..?
No It won't.
However, onCreate()
function is called somewhat more often than you think!
(like on Screen Rotation and more ...)
Checkout Activity Lifecycle and learn when onCreate()
is called.