This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public class MultiItemsCursorAdapter extends CursorAdapter { | |
private static final int FIRST_ITEM_TYPE = 0; | |
private static final int SECOND_ITEM_TYPE = 1; | |
private static final int TYPE_MAX_CCOUNT = SECOND_ITEM + 1; | |
private final LayoutInflater layoutInflater; | |
private final MVPPresenter presenter; | |
public static class ViewHolder { | |
@InjectView(R.id.text_view) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
AsyncTask can not be coded as instance inner class (non-static). | |
An instance inner class is tied to an instance of the containing class and it cannot be changed. | |
So, it is not possible to relink an instance of an async task to the new instance of the activity (on rotation). | |
What happens : when the async task finishes and onPostExecute is executed, the old activity is updated and not the new one. | |
*/ | |
public class MyActivity extends Activity { | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static class MyAsyncTask extends AsyncTask<Void, Void, Void> { | |
private WeakReference<MyFragment> fragmentWeakRef; | |
private MyAsyncTask (MyFragmentfragment) { | |
this.fragmentWeakRef = new WeakReference<MyFragment>(fragment); | |
} | |
@Override | |
protected Void doInBackground(Void... params) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomLoader extends AsyncTaskLoader<List<Data>> { | |
private List<Data> cachedData; | |
private ContentObserver observer = new ContentObserver(new Handler()) { | |
@Override | |
public void onChange(boolean selfChange) { | |
super.onChange(selfChange); | |
// CallLog Uri에 변경이 발생한 경우 LoadTask를 갱신한다. | |
onContentChanged(); |
NewerOlder