-
-
Save egglang/f9014730def32395daae657429a08f1b to your computer and use it in GitHub Desktop.
課題0の例
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
… | |
final LifecycleObserver lifecycleObserver = new LifecycleObserver() { | |
@OnLifecycleEvent(Lifecycle.Event.ON_ANY) | |
public void calledWhenOnAny(LifecycleOwner source, Lifecycle.Event event) { | |
Log.d("CODELAB", "Lifecycle state:" + source.getLifecycle().getCurrentState().name()); | |
} | |
}; | |
getLifecycle().addObserver(lifecycleObserver); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment