???????mHandler.removeCallbacksAndMessages(null);??????????????????????????е?Runnable?????????????mHandler.removeCallbacks();??mHandler.removeMessages();??????????Runnable??Message??
??????????????й?
??????????????????й????????????????????????????????????????????д????
????//——————test1
????new AsyncTask<Void?? Void?? Void>() {
????@Override
????protected Void doInBackground(Void... params) {
????SystemClock.sleep(10000);
????return null;
????}
????}.execute();
????//——————test2
????new Thread(new Runnable() {
????@Override
????public void run() {
????SystemClock.sleep(10000);
????}
????}).start();
????????????????Runnable??????????????????????????Activity?????????????á????Activity??????????????δ?????????????Activity??????????????????????й??????????????????t???????????????£?
????static class MyAsyncTask extends AsyncTask<Void?? Void?? Void> {
????private WeakReference<Context> weakReference;
????public MyAsyncTask(Context context) {
????weakReference = new WeakReference<>(context);
????}
????@Override
????protected Void doInBackground(Void... params) {
????SystemClock.sleep(10000);
????return null;
????}
????@Override
????protected void onPostExecute(Void aVoid) {
????super.onPostExecute(aVoid);
????MainActivity activity = (MainActivity) weakReference.get();
????if (activity != null) {
????//...
????}
????}
????}
????static class MyRunnable implements Runnable{
????@Override
????public void run() {
????SystemClock.sleep(10000);
????}
????}
????//——————
????new Thread(new MyRunnable()).start();
????new MyAsyncTask(this).execute();
??????????????Activity????????й????????Activity???????????????????????AsyncTask::cancel()?????????????????????????
???????δ??????????й?
?????????????BraodcastReceiver??ContentObserver??File??Cursor??Stream??Bitmap????????????????Activity?????????????????????????Щ????????????????????й???
?????Щ????
????1???????????????Activity???????????????????ApplicationContext
????2?????漰??Context??????ApplicationContext?????????????????????Щ???????????Activity??Context??????Application??Service??Activity?????Context????ó??????£?

????**???У?**NO1???Application??Service??????????Activity?????????????????μ?task??????С???????Dialog??????????Activity?в??????
????3??????????????????????÷???????????????磺Context??View )?????????????????????????????????????????????????й?
????4???????????????Activity??????????????????????????????????????????????????????????й???
?????????????????????
????????????????????????????????????????
????5??????????????????????????丳??null???????????Bitmap???????recycle()??????null6?????????????????????У????????????????????????????????????