Forked from PondThaitay/MainActivity.class (Realm Example)
Created
February 7, 2017 13:50
-
-
Save jedsada-gh/d493668458568001965cc40fde68d267 to your computer and use it in GitHub Desktop.
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 MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
Realm.init(getApplicationContext()); | |
List<Student> students = new ArrayList<>(); | |
Student student = new Student(); | |
student.setStudentId(10001); | |
student.setFirstName("Alex"); | |
student.setLastName("Ferguson"); | |
student.setGender("male"); | |
student.setCity("Scotland"); | |
student.setAge(19); | |
students.add(student); | |
student = new Student(); | |
student.setStudentId(10002); | |
student.setFirstName("Ronaldo"); | |
student.setLastName("Santos Aveiro"); | |
student.setGender("male"); | |
student.setCity("Portugal"); | |
student.setAge(22); | |
students.add(student); | |
. | |
. | |
. | |
for (Student stu : students) { | |
StudentManager.getInstance().addStudent(stu); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment