Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. package afiq/user;
  2.  
  3. import android.os.Bundle;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.support.v7.widget.LinearLayoutManager;
  6. import android.support.v7.widget.RecyclerView;
  7.  
  8. import java.util.ArrayList;
  9.  
  10. public class MainActivity extends AppCompatActivity {
  11.  
  12. private RecyclerView recyclerView;
  13. private MuridAdapter adapter;
  14. private ArrayList<Murid> muridArrayList;
  15.  
  16. @Override
  17. protected void onCreate(Bundle savedInstanceState) {
  18. super.onCreate(savedInstanceState);
  19. setContentView(R.layout.activity_main);
  20.  
  21. addData();
  22.  
  23. recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
  24.  
  25. adapter = new MuridAdapter(muridArrayList);
  26.  
  27. RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(MainActivity.this);
  28.  
  29. recyclerView.setLayoutManager(layoutManager);
  30.  
  31. recyclerView.setAdapter(adapter);
  32. }
  33.  
  34. void addData(){
  35. muridaArrayList = new ArrayList<>();
  36. muridArrayList.add(new Murid("Furqon", "8654392309", "123456789"));
  37. muridArrayList.add(new murid("ALi", "8564789560", "987654321"));
  38. muridArrayList.add(new murid("Abdullah", "8674230345", "987648765"));
  39. muridArrayList.add(new murid("awan", "3814584098", "098758124"));
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement