Skip to content

Instantly share code, notes, and snippets.

@akira-sasaki
Created October 10, 2014 05:33
Show Gist options
  • Save akira-sasaki/8854d4272fb2aab0d642 to your computer and use it in GitHub Desktop.
Save akira-sasaki/8854d4272fb2aab0d642 to your computer and use it in GitHub Desktop.
package gclue.com.helloactivity;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.util.Log;
public class MyActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my);
Log.i( "ACTIVITY", "onCreate()" );
}
@Override
public void onResume() {
super.onResume();
Log.i( "ACTIVITY", "onResume()" );
}
@Override
public void onPause() {
super.onPause();
Log.i( "ACTIVITY", "onPause()" );
}
@Override
public void onStop() {
super.onStop();
Log.i( "ACTIVITY", "onStop()" );
}
@Override
public void onRestart() {
super.onRestart();
Log.i( "ACTIVITY", "onRestart()" );
}
@Override
public void onDestroy() {
super.onDestroy();
Log.i( "ACTIVITY", "onDestroy()" );
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.my, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment