forked from ChristopherTRoy/AUTOMATED-UNIVERSITY-LOGIN
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewStudent.java
More file actions
41 lines (37 loc) · 1.28 KB
/
ViewStudent.java
File metadata and controls
41 lines (37 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.example.selab_project;
import androidx.appcompat.app.AppCompatActivity;
import android.database.Cursor;
import android.os.Bundle;
import android.widget.TextView;
public class ViewStudent extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_view_student);
String name="Name\n";
String phone="Phone\n";
String email=" Email\n";
String Class="Class\n";
String Tname="Teacher\n";
TextView n,p,e,c,t;
n=findViewById(R.id.stunames);
p=findViewById(R.id.stucontacts);
e=findViewById(R.id.stuemails);
c=findViewById(R.id.stuclass);
t=findViewById(R.id.cTeacher);
DatabaseHelper DB=new DatabaseHelper(this);
Cursor result=DB.getStudents();
while(result.moveToNext()){
name=name+result.getString(0)+"\n";
phone=phone+result.getString(2)+"\n";
email=email+" "+result.getString(3)+"\n";
Class=Class+result.getString(6)+"\n";
Tname=Tname+result.getString(7)+"\n";
}
n.setText(name);
p.setText(phone);
e.setText(email);
c.setText(Class);
t.setText(Tname);
}
}