Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. Hi All,
  2.  
  3. I my application I want to do specific task in a separate thread.I want to know where it will cause any memory leak.
  4.  
  5. public class MainActivity extends Activity {
  6.  
  7. @Override
  8. protected void onCreate(Bundle savedInstanceState) {
  9. super.onCreate(savedInstanceState);
  10. runOnThread();
  11. }
  12.  
  13. private void runOnThread() {
  14. new Thread() {
  15. private int value;
  16. @Override
  17. public void run() {
  18. while (true) {
  19. SystemClock.sleep(1000);
  20. callotherfunction(value);
  21. }
  22. }
  23. }.start();
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement