ACTIVITY.java.template 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. // explicit kill
  30. this.finish();
  31. android.os.Process.killProcess(android.os.Process.myPid());
  32. }
  33. @Override
  34. protected void onResume() {
  35. // Ideally an app should implement onResume() and onPause()
  36. // to take appropriate action when the activity loses focus
  37. super.onResume();
  38. mView.resume();
  39. }
  40. @Override
  41. protected void onPause() {
  42. // Ideally an app should implement onResume() and onPause()
  43. // to take appropriate action when the activity loses focus
  44. super.onPause();
  45. mView.pause();
  46. }
  47. }