Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
0b016b4f
Commit
0b016b4f
authored
May 18, 2020
by
Hasaranga Nadeesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
grade one test
parent
366a786d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
0 deletions
+103
-0
GradeOne01.java
GradeOne01.java
+103
-0
No files found.
GradeOne01.java
0 → 100644
View file @
0b016b4f
package
com.example.myapplicationrp
;
import
androidx.annotation.NonNull
;
import
androidx.appcompat.app.AppCompatActivity
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.EditText
;
import
android.widget.Toast
;
import
com.google.firebase.database.DataSnapshot
;
import
com.google.firebase.database.DatabaseError
;
import
com.google.firebase.database.DatabaseReference
;
import
com.google.firebase.database.FirebaseDatabase
;
import
com.google.firebase.database.ValueEventListener
;
public
class
GradeOne01
extends
AppCompatActivity
{
EditText
ans1
,
ans2
,
ans3
,
ans4
,
ans5
;
Button
save
;
DatabaseReference
ref
;
Child
child
;
long
maxid
=
0
;
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_grade_one01
);
ans1
=
(
EditText
)
findViewById
(
R
.
id
.
answer1
);
ans2
=
(
EditText
)
findViewById
(
R
.
id
.
answer2
);
ans3
=
(
EditText
)
findViewById
(
R
.
id
.
answer3
);
ans4
=
(
EditText
)
findViewById
(
R
.
id
.
answer4
);
ans5
=
(
EditText
)
findViewById
(
R
.
id
.
answer5
);
save
=
(
Button
)
findViewById
(
R
.
id
.
button
);
child
=
new
Child
();
ref
=
FirebaseDatabase
.
getInstance
().
getReference
().
child
(
"Child"
);
ref
.
addValueEventListener
(
new
ValueEventListener
()
{
@Override
public
void
onDataChange
(
@NonNull
DataSnapshot
dataSnapshot
)
{
if
(
dataSnapshot
.
exists
())
maxid
=
(
dataSnapshot
.
getChildrenCount
());
}
@Override
public
void
onCancelled
(
@NonNull
DatabaseError
databaseError
)
{
}
});
save
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
int
passCount
=
0
;
int
failCount
=
0
;
if
(
ans1
.
getText
().
toString
().
equals
(
"2"
)){
passCount
+=
1
;
}
if
(
ans2
.
getText
().
toString
().
equals
(
"4"
)){
passCount
+=
1
;
}
if
(
ans3
.
getText
().
toString
().
equals
(
"7"
)){
passCount
+=
1
;
}
if
(
ans4
.
getText
().
toString
().
equals
(
"11"
)){
passCount
+=
1
;
}
if
(
ans5
.
getText
().
toString
().
equals
(
"9"
)){
passCount
+=
1
;
}
failCount
=
5
-
passCount
;
child
.
setAnswer1
(
ans1
.
getText
().
toString
());
child
.
setAnswer2
(
ans2
.
getText
().
toString
());
child
.
setAnswer3
(
ans3
.
getText
().
toString
());
child
.
setAnswer4
(
ans4
.
getText
().
toString
());
child
.
setAnswer5
(
ans5
.
getText
().
toString
());
child
.
setCorrectAns
(
String
.
valueOf
(
passCount
));
child
.
setIncorrectAns
(
String
.
valueOf
(
failCount
));
ref
.
child
(
String
.
valueOf
(
maxid
+
1
)).
setValue
(
child
);
Toast
.
makeText
(
GradeOne01
.
this
,
"Data Inserted"
,
Toast
.
LENGTH_SHORT
).
show
();
if
(!(
ans1
.
getText
().
toString
().
equals
(
"2"
))){
openDialog
();
}
}
});
}
public
void
openDialog
(){
DialogMenu
dialogMenu
=
new
DialogMenu
();
dialogMenu
.
show
(
getSupportFragmentManager
(),
"Example dialog"
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment