Anuna Confidence Nneoma-Design and Implementation of A Quiz Application For Android Device
Anuna Confidence Nneoma-Design and Implementation of A Quiz Application For Android Device
INTRODUCTION
1.1 BACKGROUND
The mobile applications market is currently undergoing rapid expansion, as
mobile platforms continue to improve in performance, and as the users’ need
for a wide variety of mobile applications increases. The latest mobile platforms
allow for extensive utilization of network resources, and thus offer a strong
alternative to workstations and associated software. Software development for
mobile platforms comes with unique features and constraints that apply to most
of the lifecycle stages. The development environment and the technologies that
support the software are different compared to “traditional” settings. The most
important distinguishing characteristics are identified in (Abrahamsson, et al.,
2004). Environment particularities include: a high level of competitiveness;
necessarily short time-to-delivery; and added difficulty in identifying
stakeholders and their requirements. Development teams must face the
challenge of a dynamic environment, with frequent modifications in customer
needs and expectations. (Abrahamsson, 2007) Technological constraints apply
to mobile platforms in the form of limited physical resources and rapidly
changing specifications. There is also a great variety of devices, each with
particular hardware characteristics, firmware and operating systems. Another
view of the constraints associated with mobile applications is presented in
(Hayes, 2003). The author mentions two types of constraints, evolving and
inherent. Evolving constraints, such as bandwidth, coverage and security,
currently apply to the mobile technology, but are likely to be addressed and
possibly resolved in the near future. On the other hand, inherent constraints
such as limited screen real estate, reduced data entry capability (due to a limited
keypad for example), memory capacity, processing power and limited power
reserve, are permanent, at least relative to desktop environments. Various
approaches must be used in order to lower the impact of inherent constraints.
1
of competition. Teams that develop mobile applications are usually small to
medium-sized, co-located, and generally use object-oriented tools and
practices. The applications themselves are small-sized, are not safety-critical,
and do not have to satisfy interoperability or reliability constraints. They are
delivered in rapid releases in order to meet market demands, and are targeted
at a large number of end-users. The author suggests agile methods as a suitable
approach to development, by comparing the above features to agile “home
ground” characteristics: small-scale, application-level software, developed in
a highly dynamic environment by a small to medium-sized team using object-
oriented approaches, in relatively short development cycles.
SOFTWARE
Software refers to one or more computer programs and data held in the storage
of the computer for some purposes. In other words software is a set of
programs, procedures, algorithms and its documentation. Program software
performs the function of the program it implements, either by directly
providing instructions to the computer hardware or by serving as input to
another piece of software. The term was coined to contrast the old term
hardware (meaning physical devices).
CLASSES OF SOFTWARES
Practical computer systems divide software systems into three major classes
system software, programming software and application software, although the
distinction is arbitrary, and often blurred.
2
SYSTEM SOFTWARE
System software provides the basic functions for computer usage and helps run
the computer hardware and system. It includes a combination of the following:
· Device drivers
· Operating systems
· Servers
· Utilities
· Window systems
System software is responsible for managing a variety of independent
hardware components, so that they can work together harmoniously. Its
purpose is to unburden the application software programmer from the often
complex details of the particular computer being used, including such
accessories as communications devices, printers, device readers, displays and
keyboards, and also to partition the computer's resources such as memory and
processor time in a safe and stable manner.
PROGRAMMING SOFTWARE
Programming software usually provides tools to assist a programmer in writing
computer programs, and software using different programming languages in a
more convenient way.
The tools include:
· Compilers
· Debuggers
· Interpreters
· Linkers
· Text editors
APPLICATION SOFTWARE
Application software is developed to aid in any task that benefits from
computation. It is a broad category, and encompasses software of many kinds,
including the internet browser being used to display this page. This category
includes:
· Business software
3
· Databases
· Decision making software
· Educational software
· Image editing
· Industrial automation
· Mathematical software
· Medical software
· Molecular modelling software
· Quantum chemistry and solid state physics software
· Simulation software
· Spreadsheets
· Telecommunications (i.e., the Internet and everything that flows on it)
· Video games
· Word processing
ANDROID APPLICATION
Android app is a mobile software application developed for use on devices
powered by Google's Android platform. An Android application can be written
in several different programming languages such as, Java, C or C++.
Application developers can easily tap into the huge stack of system services,
tools and libraries to use in their application if required.
1.3 MOTIVATION
As Android is rapidly getting famous day by day and the number of its users
are increasing with every blink of eye, because it is easy to access the necessary
android based applications on smart phones and tablets in your hands.
Therefore, I found this idea interesting, easy and time efficient to facilitate the
4
users in this way without any difficulty. There are many online quiz
applications available on internet, but most of them are only for entertainment,
fun and can only be used with internet connection. Moreover, if one is going
to appear in any test or interview, then it is difficult and time consuming for
them to read the full books or articles related to specific fields for the
preparation or revising their knowledge. But the most attractive feature of this
app is that it will take learning and fun side by side. The application provides
users the facility to revise their knowledge or to learn something advantageous
at one place without wasting their time.
5
1.6 SIGNIFICANCE OF THE STUDY
An android quiz application is going to play a fundamental role in helping
students and learners to prepare themselves for different examinations directly
through smart phones and tablets in hands. One of the major aim of this project
is to facilitate students in learning, gaining and improving their knowledge
skills. At the meantime, the app provides users fun so that the users can prepare
for interviews, entrance tests or any other corresponding purposes in a fresh
mood and can’t get bored or frustrated due to dullness of app. The application
is designed to facilitate users to be able to take short quizzes using android
devices such as smart phones and tablets.
Activity: An activity is a user interface that allows the user to interact with the
screen, to perform actions.
6
IDE: integrated Development Environment (IDE) is a software application that
provides comprehensive facilities to computer programmers for software
development.
Chapter 4: deals with the design and implementation of the project by stating
the specification required.
7
CHAPTER 2
LITERATURE REVIEW
Google wanted to enter the mobile phone market mostly to sell more ads in
this new area. They acquired in July 2005 Android Inc., appointing Andy
Rubin as their Director of Mobile Platforms group. Google then entered the
mobile market, not as a new handset manufacturer but instead by introducing
a new Operating System(OS), called “Android” on November 5th, 2007.
Google wanted the OS to run on any device, whether they were HTC, Samsung
or Motorola. With this vision and the vision of having Android based devices
being able to do all a pc could do, they launched the Open Handset Alliance,
to help make it possible.(Gadhavi and Shah 2010).
8
proprietary operating systems such as iOS (Apple Inc. products), Blackberry
OS (Blackberry), S40 OS (Nokia), Windows OS (Windows Phone) etc., which
are licensed and controlled by certain companies. As of May 2013, Android
dominates the smartphone market accounting 74.4% of worldwide smartphone
sales [Gartner].
9
During the Building, Debugging and Testing phase the Android project is first
built into a debuggable .apk package(s), which can install and run on and
Android emulator or an Android-powered device. After building and installing
the Application on an Android powered device, the developer can check for
and debug errors manually or using the SDK debugging and logging tools.
After debugging the application, a developer should test the efficiency of the
developed application and various other aspects using the Android SDK
testing tools. The publishing phase involves releasing and distributing the
finished application to the users. figure 2 shows the Android workflow in
chronological order. (Android Open Source Project 2015h.)
11
2.4.1 Linux Kernel
Android uses, and relies upon the Linux version 2.6 for core system services,
such as security, memory management, process management, network stack
and driver model. The kernel also acts as an abstraction layer between the
hardware and the rest of the software stack. The Kernel has been accredited
with being one of the things that sets Android apart, with its functionality and
stability.
2.4.3 Libraries
Android includes a set of C/C++ libraries used by various components of the
Android system. These capabilities are exposed to developers through the
Android application framework. Some of the core libraries are listed below:
- System C library - a BSD-derived implementation of the standard C system
library (libc), tuned for embedded Linux-based devices
- Media Libraries - based on PacketVideo's OpenCORE; the libraries support
playback and recording of many popular audio and video formats, as well as
static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
- Surface Manager - manages access to the display subsystem and seamlessly
composites 2D and 3D graphic layers from multiple applications
- LibWebCore - a modern web browser engine which powers both the
Android browser and an embeddable web view
- SGL - the underlying 2D graphics engine
- 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries
use either hardware 3D acceleration (where available) or the included, highly
optimized 3D software rasterizer
12
- FreeType - bitmap and vector font rendering
- SQLite - a powerful and lightweight relational database engine available to
all applications
2.4.5 Applications
Android will ship with a set of core applications including an email client, SMS
program, calendar, maps, browser, contacts, and others. All applications are
written using the Java programming language.
(Android Developers 2012, Web Designers Directory 2011).
14
Figure 4. Growth in Activations. Source : Android (2012).
16
project pitfalls. This section deals with various work done on identification of
risks and their mitigation.
In terms of previous efforts to identify risk factor, Boehm’s work has probably
had more influence on practitioner‘s community than any other . Boehm
identified top ten list of software risks based on his experience in defence
industry. According to him personnel shortfalls, unrealistic schedules and
budgets, developing the wrong functions and properties, developing the wrong
user interface, gold plating, continuing stream of requirements changes,
shortfalls in externally furnished components, shortfalls in externally
performed tasks, real-time performance shortfalls, straining computer science
capabilities are the top risks that a software company faces. To manage these
risks Boehm proposed theory ―W: Make everyone a winner”. This theory
worked on two subsidiary principles: ―plan the flight and fly the plan and
identify and manage your risks. Accordingly, various mitigation strategies to
counter the above risks were proposed such as staffing with top talent,
requirement scrubbing, prototyping, reference checking, detailed multisource
cost and schedule, compatibility analysis etc. Although, the study details out
the risks and their mitigation but fails to convey the tools used to derive these
risks other than the fact that Boehm used his own experience and a survey of
17
the experienced project managers to identify these risks. According to
Ropponen and Lyytinen , the study lacks a theoretical foundation. It has
multiple items which refer to the same phenomenon.
Sherer used a three dimensional framework to explain the software risks. She
identified technical, organization and environment as three dimensions on
which the software risks were explained. To combat these risks various risk
mitigation technique were also proposed. In the study, technical risks were
identified as the most important risks affecting the software projects. Use of
HIPO charts, data flow diagrams, prototyping, simulation modelling,
benchmarking, fault tolerant methods were some of the risk management tools
proposed in the study. Her study fails to link these risks to the Software
Development Life Cycle. Moreover, the study fails to provide constructive
tools to mitigate the risks relating to software vendor relationships and
outsourcing.
Field in his article states that, ―projects fail too often because the project
scope was not fully appreciated and/or user needs not fully understood‖. He
developed a comprehensive list of pitfalls that must be avoided to execute a
successful software project. The list includes misunderstanding user
requirements, project scope ill defined, poorly managed changes; change in the
chosen technology, business needs change, deadlines unrealistic, resistant
users, lost sponsorship, lack of experienced personnel, best practice and
lessons ignored by managers. This list was re-used by Reel to adduce various
risk management strategies such as building the right team, giving team what
they need, involving customers or user in the development, setting up
procedures and expectations for high level of quality before the development,
tracking the progress religiously and institutionalizing a process for learning
from past mistakes.
18
and failure to gain user commitment; can be mitigated by relationship
management, trust building and political skills.
b) Misunderstanding the requirements and lack of frozen requirements can be
managed by educating the user/customer on the impact of scope changes in
terms of project cost and schedule; tools such as multi-criteria decision making
and function point analysis can also be used to mitigate these risks.
c) Failure to manage end user expectations, lack of required knowledge/skills
in project personnel, introduction of new technology and
insufficient/inappropriate staffing can be mitigated by internal reviews coupled
with external reviews, use of work-breakdown structure, development of
contingency plans to manage personnel shortfall and use of new technology.
d) Changing scope/objectives and conflict between user departments can only
be managed by contingency and disaster planning. Inspite of such detailed
analysis this study fails to link it with the software development cycle.
19
misunderstanding of requirements, lack of adequate user involvement, lack of
required knowledge/skills in project personnel, lack of frozen requirements,
changing scope/objectives, introduction of new technology, failure to manage
end user expectations, insufficient/inappropriate staffing, conflict between user
departments.
According to the study conducted on the Indian software industry, the Indian
software industry is not only facing the problem of attrition from the home
front but is also facing problem from the client side as well. There were a
number of cultural and political issues that US managers perceive as irritants
or barriers. One such issue is the apparent unwillingness of Indian software
professionals to point out potential problems up-front, and in general, an
unwillingness to say no for fear of offending the clients. Another related
weakness is the lack of familiarity of many Indian firms and professionals with
the work culture and work norms in the west, and especially in the United
States. Other difficulties include resistance within the US to foreign
programmers, poor telecommunication infrastructure, and the delays in
obtaining the required visas for Indian programmers.
Addison and Vallabh conducted a three phase Delphi survey of the South
African software industry and identified unclear or misunderstood
scope/objectives, misunderstanding the requirements, failure to gain user
involvement, developing the wrong software functions, unrealistic schedule
and budgets, continuous requirement change, inadequate knowledge/skills,
lack of effective project management methodology, gold plating as the key risk
factors. They also studied the effectiveness of various controls or strategies to
reduce the occurrence of risk factors. They found that experienced project
managers use controls such as assigning of responsibilities to team members
and stabilizing requirements and specifications more than inexperienced
20
project managers. The study lacked in the area of data collection as the sample
size taken was too small to generalize the risks and their mitigation strategy.
Costa et al. in their study presented a technique for assessing the risk level of
a software project based on its systemic and specific risks. They introduced an
approach to estimate the probability distribution of earnings and losses
incurred by an organization according to its software project portfolio. This
technique was supported by an empirical study to assess the relative
importance of risk factors for software development projects. The following
risk factors were keyed out: client risk, control risk, analysis risk, team risk,
21
testing risk, policies/organization structure risk and design risk. However, no
attempt was made in the study to address the issue of managing and mitigating
these risks.
Dey et al through a case study on TCPO in Barbados identified the key risk
factors as: the unavailability of key personnel, employee turnover and
incorrect/incomplete requirement. The study also developed an integrated
framework for managing risk in software development with the involvement
of the stakeholders in TCPO. To control risks in the project they proposed
constant project monitoring, dynamic scope management plan, involvement of
client in the development process and effective communication between
developer and client as some of the strategies for mitigating the risks.
Zhou et al analysed ten case studies in the UK, USA and New Zealand to
identify critical risk factors (scope creep, unwillingness of customer to accept
final systems, poor project management, etc.) at the pre-implementation and
implementation stage of the software project. The study is limited to
identification of risks at pre-implementation and implementation stage and
ignores the risk occurring in post-implementation stage of software projects.
The study fails to provide any insight into the risk management and mitigation
strategies.
22
proprietorship, project management, change management, management of
projects, recognition of red flags, management of risk and benefit realization.
The study also identified the various risk management techniques used in
these projects. Overall, the study aimed at reviewing and reassessing the
status of risk management research in literature and practices in a sample of
Australian public sector agencies. The study is helpful as it provides a
complete understanding of risk and risk management in public sector.
Whether the same can be applied in private sector software companies is not
clear from the study.
Thus, it can be clearly seen that numerous researches have been devoted to the
identification and management of the software risk. Various methodologies
have been used for keying out the list of major risk factors. As a result, there
have been various lists of risk factors with some similarities and some
differences. Therefore, a comprehensive and exhaustive list encompassing all
23
the risk factors affecting the software projects is prepared in the following
section.
24
Figure 6: JAGRAN Josh Computer General Knowledge Quiz
25
Figure 7. TreeKnox Computer Quiz
26
Figure 8. Quiz App.
Although there are many apps that focus on quiz, but there are limited
applications with focus on learning or improving knowledge in curriculum
area. Most of the other apps are entertainment- based with little focus on
educational paradigm.
There are many limitations with the existing systems mentioned above. To
overcome such limitations, we propose an offline and user-friendly
application, which mainly focuses on gaining knowledge as well as
entertainment. Therefore, when one is amazed with playing the quiz, he/she is
gaining curriculum knowledge with emphasis on not only gaining good grades
but also having better understanding of the subject matter.
Other unique features of Quiz application that is lacking in other apps is the
simplicity, User friendly interface and the fact that the app can be used without
internet access unlike most quiz apps that require internet access before they
can be accessed. Other features regarding the Quiz app and other apps seemed
to be quite similar, i.e. answering questions with multiple choices , scoring as
high as possible and so on.
27
CHAPTER 3
METHODOLOGY
3.0 INTRODUCTION
Methodology is an early phase in development system. It is included into this
chapter to see how the project will be developed. A plan must be drawn up to
guide the development towards the project goals. Methodology is the study of
methods or a body of method. It may be defined as a collection of procedures,
techniques, tools and documentation aids. These may help the software
developers to speed up and simplify the software development process. A
methodology consists of a set of phases that in turn may consist of sub-phases.
These phases are important in guiding the developers to the choice of
techniques at various stages in the project. Additionally, a methodology helps
the developers to plan, manage, control and evaluate information system
project.
28
SDLC methodologies have been developed to guide the processes involved. In
general, an SDLC methodology follows the following steps:
3. The proposed system is designed. Plans are laid out concerning the physical
construction, hardware, operating systems, programming, communications
and security issues.
4. The new system is developed. The new components and programs must be
obtained and installed. Users of the system must be trained in its use, and all
aspects of performance must be tested. If necessary, adjustments must be made
at this stage.
5. The system is put into use. This can be done in various ways. The new
system can phased in, according to application or location, and the old system
gradually replaced. In some cases, it may be more cost-effective to shut down
the old system and implement the new system all at once.
6. Once the new system is up and running for a while, it should be exhaustively
evaluated. Users of the system should be kept up-to-date concerning the latest
modifications and procedures.
29
Enforces planning and control
1. Find tools to develop the interface of the system depending on the input
below:
30
The result of the planning phase will be reported for the system that being
applied. Therefore the planning purpose is crucial part to implement.
31
1) Interface:
It’s required to create a user friendly environment or layout to guide a users
and make the app easy to navigate. The layout views to be used for the app
must be decided before starting the project and the interface will be designed
with xml.
2) Coding:
The program will need a function to generate the algorithm that will be applied
to the target image. This coding is necessary to build the program to run
successfully. This is the harder part that I face, that must be implement, if error
occur while compilation is doing, the program must be corrected and there
must have some adjustment to be done especially the coding part.
3) Prototype:
Here, the prototype of the program is to show the initial part of the application
to the users, for them to evaluate it before implementation and also consider
their suggestions.
32
3.3.1 Current Program/Application
The current algorithm and techniques that have already been implemented in
the application will be the guidance for me to do an observation . Therefore,
there are necessary for me to do a research towards this application which can
give me a comparison on which algorithm to be applied in this project.
3.3.2 Internet/Journal/Book
The information about the algorithm and techniques can be found through the
book, but the information that can get from the internet much more large and
spacious. There are various researches about the current techniques on
software development that can be found from the journal in the internet.
33
CHAPTER 4
SYSTEM DESIGN & IMPLEMENTATION
34
4.2 CHOICE OF PROGRAMMING LANGUAGES
4.2.1 Java Programming Language
As mentioned before in the report, the Java programming language was chosen
for the purpose of the project. The main reason for choosing Java was because
Android development primarily relies on it. As Reto Meier highlights in his
book, even though development can be achieved using low-level languages C
or C++, developers are required to understand the specific hardware they are
coding for. Thus, writing code using C/C++ is a difficult and complicated task,
something that made these approaches outmoded. However, by introducing
Java hosted MIDlets, applications that make use of the Mobile Information
Device Profile (MIDP), there was a revolutionary shift in software industry for
smartphones. MIDlets are executed on a Java Virtual Machine (JVM), a
process that abstracts the hardware and enables developers to build
applications that run on devices that support Java run time. As a consequence,
Java became the most popular programming language for developing android
applications.
The popularity of the Java programming language combined with the openness
of the Android OS, enabled the developers to share information and solutions
which they encounter using the same language. As a result, the internet has
become an excellent source for support and exchange of ideas between the
developers for Android. By taking into account the above factors, combined
with the fact that Java is extensively taught as part of our course, led to the
decision of choosing Java as the main programming language for this project.
4.2.2 XML
The GUI (Graphical user interface) was developed using XML (Extensible
Markup Language), but controlled with Java programming language.
35
4.3 SYSTEM REQUIREMENT
System requirement are the properties that a system must have in other for a
hardware or software application to run smoothly and efficiently. Failure to
meet these requirements can result in installation problems or performance
problems.
Software
Android Studio (IDE)
Photoshop cs6
Android emulator
36
37
Figure 11: Main menu.
38
39
Figure 12: About screen.
4.4.3 Question screen
The Question screen (Fig. 13 and 14) is used to show Question with multiple
answers (options) for the user to help him/her to answer the question correctly
and at any time user can see the score progress status on the top of this screen.
This screen has a button below the options that can be click on at any time to
quit the application. The Question screen consist of view groups, radio buttons,
Textviews and two button.
40
41
Figure 13: Question screen.
42
43
Figure 14: Question screen.
4.5 IMPLEMENTATION
The implementation of the project adhered strictly to the application
requirements as stated in chapter 4. The project was developed in the Android
studio integrated development environment (IDE) using the Android software
development kit (Android SDK Tools). The application is targeted at any
Android mobile device running at least Android 2.2, which corresponds to
API level 8 up to the latest Android SDK Version. As at the time of writing
this report, Android 4.4.2 (Android KitKat) API level 19 is the latest Android
SDK Version.
The application is made up of several java classes among which are the activity
classes that are responsible for displaying the graphical user interface GUI and
also for manipulating data for this application. In other words, an activity class
normally takes care of the creation of a window in which user interface (UI)
can be placed.
44
Figure 16: Java class structure
The java classes contained in the application package are responsible for
displaying different UI in the application and for data manipulation. The data
45
package contains all data management java classes. The library package
contains library classes while util package contains a java class to display the
user result. The contents of the packages are as shown in the diagram below:
4.6 TESTING
After writing all the source code and fixing all the major bugs, the testing done
for the application was carried out on android emulator and real Android
mobile device - Samsung Galaxy, Gionee and Infinix. The screen of the mobile
46
phone was printed and saved to a file with the help of default Screenshot and
snipping tool software program. The software basically displays the screen of
any Android mobile device connected to a computer on the computer screen
and whatever application running on the phone will be displayed
simultaneously on the computer.
47
48
49
Figure 19: result
50
51
CHAPTER 5
SUMMARY & CONCLUSION
5.0 SUMMARY
Most of the goals set at the beginning of the project for this application have
been achieved with its implementation. There are quite a few parts of the
application which I found challenging. The most difficult part of the
implementation was finding a way to hold the set of questions retrieved from
the database and displaying them in a view with their set of options one after
the other. For this problem, I created a class to hold all question object and
added them to an array. To display each of the questions, I only needed to
iterate through the array using the position of each of the elements in that array.
5.1 CONCLUSION
The goal of this project was to develop mobile quiz application for Android
device, with user friendly interface. These goals have been successfully
achieved on completion of this project. The project was tested on both Android
emulator and Android mobile device. The application ran smoothly and the UI
components responded as expected.
REFERENCES
[1] Selecting a development approach, 2007 [online].[Accessed 15th April
2013].
Available from: http://www.cms.gov/Research-Statistics-Data-and-
Systems/CMS-Information-
Technology/XLC/Downloads/SelectingDevelopmentApproach.pdf
52
[2] Android SDK. (2013). [Online]. Available:
http://developer.android.com/sdk/index.html
[3] Android UI Testing. (2013). [Online]. Available:
http://developer.android.com/tools/testing/testing_ui.html
[4]http://www.testcurrentaffairs.com/2015/08/top-100-computer-quiz-
questions-and-answers.html
[5] http://placement.freshersworld.com/computer-quiz-2/33121979385
[6] Android Activity. Official Android Developer Reference website.
Accessed
30.05.2014.http://developer.android.com/reference/android/app/Activity.html
[7] Android (operating system). Wikipedia Foundation. Accessed 30.05.2014.
http://en.wikipedia.org/wiki/Android_%28operating_system%29
[8] Nigeria - Mobile Market - Overview, Statistics and Forecasts. Accessed
28.05.2014.
http://www.budde.com.au/Research/Nigeria-Mobile-Market-Overview-
Statisticsand-Forecasts.html
[9] Mobile Apps. (2010). Mobile Apps Group. Retrieved from
http://www.informatics-ventures.com/connect/mobile-apps-group
[10] Software Engineering - Olayanju Taiwo Abolaji Computer Department,
Federal College of Education (Tech.) Akoka, Lagos
53
SOURCE CODE
Activity_main.xml:
Main Activity XML
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical"
android:scrollbars="vertical"
tools:context="com.example.android.quizproject3.MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ede7f6"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:shadowColor="#9E9E9E"
android:text="@string/welcome_note"
android:textColor="#673ab7"
android:textSize="24sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:text="@string/You_think_you_know_the_continent_well_Provide_your_name_to_conti
nue"
54
android:textColor="#424242"
android:textSize="16sp"
android:textStyle="bold"/>
<EditText
android:id="@+id/name_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:hint="@string/name"
android:inputType="textCapWords"
android:textColor="#000000"
android:textColorHint="#616161"
android:textSize="20sp"/>
<TextView
android:id="@+id/question_one"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_1"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold">
</TextView>
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_1_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal">
</TextView>
<RadioGroup
android:id="@+id/question_one_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/marcus_garvey_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
55
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/marcus_garvey"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/nnamdi_azikwe_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/nnamdi_azikwe"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/derek_walcott_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/derek_walcott"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/malcolm_x_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/malcolm_x"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/question_two"
android:layout_width="wrap_content"
56
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_2"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_2_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal">
</TextView>
<RadioGroup
android:id="@+id/question_two_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/sixth_july_1967_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/sixth_july_1967"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/fifteen_january_1966_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/fifteenth_january_1966"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/sixteen_June_1968_radio_button"
57
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/sixteenth_june_1968"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/sixth_April_1966_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/sixth_april_1966"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/question_three"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_3"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_3_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
58
<RadioGroup
android:id="@+id/question_three_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/hundred_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/hundred"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/one_seventy_five_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/one_seventy_five"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/one_hundred_and_nine_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/one_hundred_and_nine"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/one_hundred_and_eight_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/one_hundred_and_eight"
android:textColor="#000000"
android:textSize="14sp"
59
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/question_four"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_4"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_4_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
<RadioGroup
android:id="@+id/question_four_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/tenth_nov_1991_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/tenth_november_1991"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
60
android:id="@+id/eleventh_feb_1990_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/eleventh_february_1990"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/twelfth_feb_1991_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/twelfth_february_1991"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/ninth_march_1989_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/ninth_march_1989"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/question_five"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_5"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"/>
61
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_5_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
<RadioGroup
android:id="@+id/question_five_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/ghana_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/ghana"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/zimbabwe_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/zimbabwe"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/nigeria_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/nigeria"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
62
<RadioButton
android:id="@+id/senegal_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/senegal"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/question_six"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_6"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_6_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
<RadioGroup
android:id="@+id/question_six_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/year_1962_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
63
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/nineteen_sixty_two"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/year_1952_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/nineteen_fifty_two"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/year_1980_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/nineteen_eighty"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/year_1960_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/nineteen_sixty"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#000000" />
<TextView
android:id="@+id/question_seven"
android:layout_width="wrap_content"
64
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_7"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_7_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
<RadioGroup
android:id="@+id/question_seven_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/uganda_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/uganda"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/angola_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/angola"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/ethiopia_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
65
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/ethiopia"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/congo_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/congo"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/quetion_eight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_8"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_8_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
<RadioGroup
android:id="@+id/question_eight_radio_group"
66
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/walter_sisulu_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/walter_sisulu"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle" />
<RadioButton
android:id="@+id/govan_mbeki_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/govan_mbeki"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/walter_rodney_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/walter_rodney"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/oliver_tambo_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/oliver_tambo"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
67
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/question_nine"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_9"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_9_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal" />
<RadioGroup
android:id="@+id/question_nine_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/sudan_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/sudan"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/egypt_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
68
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/egypt"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/djibouti_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/djibouti"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/gambia_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/gambia"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginTop="16dp"
android:background="#757575" />
<TextView
android:id="@+id/question_ten"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:fontFamily="sans-serif"
android:text="@string/question_10"
android:textColor="#000000"
android:textSize="16sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
69
android:layout_marginTop="14dp"
android:fontFamily="sans-serif"
android:text="@string/question_10_content"
android:textColor="#000000"
android:textSize="14sp"
android:textStyle="normal"
/>
<RadioGroup
android:id="@+id/question_ten_radio_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RadioButton
android:id="@+id/fifty_four_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="14dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/fifty_four"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/_seventy_two_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/seventy_two"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/sixty_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/sixty"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
<RadioButton
android:id="@+id/seventy_four_radio_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
70
android:layout_marginStart="16dp"
android:paddingEnd="24dp"
android:paddingLeft="24dp"
android:paddingStart="24dp"
android:text="@string/seventy_four"
android:textColor="#000000"
android:textSize="14sp"
android:theme="@style/RadioButtonStyle"/>
</RadioGroup>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:id="@+id/clear_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_weight="1"
android:text="@string/clear"
android:textSize="14sp"
android:textStyle="bold"/>
<Button
android:id="@+id/submit_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:layout_weight="1"
android:text="@string/submit"
android:textSize="14sp"
android:textStyle="bold"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
71
JAVA File –The Application Logic MainActivity.java
JAVE File
package com.example.android.quizproject3;
import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.Toast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
submitButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
72
int solutionId2 = radioGroup2.getCheckedRadioButtonId();
73
//Get the id of the RadioButton that is checked and save it
//as an integer variable.
int solutionId6 = radioGroup6.getCheckedRadioButtonId();
74
//Get the id of the RadioButton that is checked and save it
//as an integer variable.
int solutionId10 = radioGroup10.getCheckedRadioButtonId();
submitButton.setEnabled(false);
});
// Get the id of the button that clear the result of the quiz
Button clearButton = (Button) findViewById(R.id.clear_button);
clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
score = 0;
submitButton.setEnabled(true);
75
findViewById(R.id.question_five_radio_group);
radioGroup5.clearCheck();
});
76