-
Notifications
You must be signed in to change notification settings - Fork 1
Exam
Testpress Exams SDK helps you to integrate Testpress exam features in your android app seamlessly.
The Gradle dependency is available via jCenter.
repositories {
jcenter()
}
dependencies {
implementation 'com.github.testpress:exam:1.3.25'
}
There are two ways by which Testpress exams can be integrated with your application.
Use this method if Testpress exams view should be opened inside a container activity as a fragment. You might want to consider using this in case you have a navigation drawer and want to have an item as exams.
public static void show(FragmentActivity activity,
Integer containerViewId,
TestpressSession testpressSession)
Parameters:
- activity - Parent activity which should hold the fragment
- containerViewId - Container view id in which the exam fragment should be embedded
- testpressSession - TestpressSession got from the core module
TestpressExam.show(
this,
R,id.fragment_container,
TestpressSdk.getTestpressSession(this)
);
If the parent activity overrides
protected void onActivityResult(int requestCode, int resultCode, Intent data)
it should call its super
super.onActivityResult(requestCode, resultCode, data)
Use this method if you want Testpress exams view to be open as a new Activity.
public static void show(Context context, TestpressSession testpressSession)
Parameters:
- context - Context to start the new activity.
- testpressSession - TestpressSession got from the core module
TestpressExam.show(this, TestpressSdk.getTestpressSession(this));
- You must initialize the Testpress SDK successfully using core module before using the exam module.
If you want to customize the look and feel, you can override the following variables in res/color.xml
based on your requirements.
<resources>
<color name="testpress_actionbar_background">#333399</color>
<color name="testpress_actionbar_text">#ffffff</color>
<color name="testpress_color_primary">#ff0000</color>
<color name="testpress_button_text_color">#00ff00</color>
</resources>
Here, testpress_color_primary
is the primary theme color.
Refer the samples app for example implementation.