Advertisement
Guest User

Untitled

a guest
Nov 1st, 2013
304
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. abstract class EntityActivity extends Activity{
  2. @Override
  3. public void onCreate(Bundle savedInstanceState) {
  4. super.onCreate(savedInstanceState);
  5.  
  6. if (isOnline()) {
  7. doSomethingWhereWeAreOnline();
  8. } else {
  9. offlineRun(getClass());
  10. }
  11. }
  12.  
  13. protected abstract void doSomethingWhereWeAreOnline();
  14. }
  15.  
  16. class MyActivity extends EntityActivity {
  17. @Override
  18. protected void doSomethingWhereWeAreOnline() {
  19. setContentView(R.layout.main);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement