I need to make onPause() event in MainActivity class. Is it possible somehow generate souch kind of things automatically or I need to type evrything on keyboard?
currently my class looks like:
package com.example.llk;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.Toast;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toast.makeText(this,"onCreate()", Toast.LENGTH_LONG).show();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
There are onCreate and onCreateOptionsMenu events, but no onPause. Can IDE generate it automatically?
If i understood your question right, right click your code and select “Source” > “Override/implement methods” and under the Activity tab there should be a onPause() method, check it and click OK and Eclipse will generate the code for you.