ACTIVITY.java.template 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2012 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package %PACKAGE%;
  17. import android.app.Activity;
  18. import android.os.Bundle;
  19. // Renderscript activity
  20. public class %ACTIVITY% extends Activity {
  21. // Custom view to use with RenderScript
  22. private DriverView mView;
  23. @Override
  24. public void onCreate(Bundle icicle) {
  25. super.onCreate(icicle);
  26. // Create our view and set it as the content of our Activity
  27. mView = new DriverView(this);
  28. setContentView(mView);
  29. }
  30. @Override
  31. protected void onResume() {
  32. // Ideally an app should implement onResume() and onPause()
  33. // to take appropriate action when the activity loses focus
  34. super.onResume();
  35. mView.resume();
  36. }
  37. @Override
  38. protected void onPause() {
  39. // Ideally an app should implement onResume() and onPause()
  40. // to take appropriate action when the activity loses focus
  41. super.onPause();
  42. mView.pause();
  43. }
  44. }