Last active
March 20, 2016 11:11
-
-
Save SeongUgJung/b0d9bd0e33b962ef3796 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 MainActivity extends Activity { | |
@Override public void onCreate(Bundle savedInstance) { | |
RecyclerView rv = findViewById(R.id.lv); | |
RecyclerView.Adapter adapter = new SampleAdapter(); | |
rv.setAdapter(adapter); | |
adapter.add(new Data()); | |
adapter.add(new Data()); // add Data | |
adapter.nofityDatasetChanged(); // refresh Screen | |
} | |
private static class SampleAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |
List<Data> datas; | |
SampleAdapter() { | |
datas = new ArrayLst<Data>(); | |
} | |
public void add(Data data) { | |
datas.add(data); | |
} | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment