Result java choice solution
Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??
- if the dominant answer is A then the result is A
- if the dominant answer is B then the result is B
- if the dominant answer is C then the result is C
- if the dominant answer is D then the result is D
if A is equal to B, C, D then the result is E
the choice of using imagebutton and 6 questions
the result I have typed in string.xml what is the code so that each result declaration is called ... ??
please help me
----under this my code, how do the statements for the formula above:-----
public class mquiz extends Activity implements View.OnClickListener{
Button btn_next;
ImageButton jawabA, jawabB, jawabC, jawabD;
TextView question;
String kuisioner ={"Your hobbies..??","Which object do you like...??"};
//Pilihan Gambar
int pilihA ={R.drawable.seeing, R.drawable.picture};
int pilihB ={R.drawable.singing, R.drawable.songer};
int pilihC ={R.drawable.readwrite, R.drawable.writestory};
int pilihD ={R.drawable.activity, R.drawable.football};
private int indeks;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_quiz);
setContentView(R.layout.menu_quiz1);
question=(TextView)findViewById(R.id.question);
question.setText(kuisioner[0]);
jawabA=(ImageButton)findViewById(R.id.pilihanA);
jawabA.setImageResource(pilihA[0]);
jawabA.setOnClickListener(this);
jawabB=(ImageButton)findViewById(R.id.pilihanB);
jawabB.setImageResource(pilihB[0]);
jawabB.setOnClickListener(this);
jawabC=(ImageButton)findViewById(R.id.pilihanC);
jawabC.setImageResource(pilihC[0]);
jawabC.setOnClickListener(this);
jawabD=(ImageButton)findViewById(R.id.pilihanD);
jawabD.setImageResource(pilihD[0]);
jawabD.setOnClickListener(this);
}
@Override
public void onClick(View view){
indeks++;
if (view == jawabA){
jawabA.setImageResource(pilihA[indeks]);
}
if (view == jawabB){
jawabB.setImageResource(pilihB[indeks]);
}
if (view == jawabC){
jawabC.setImageResource(pilihC[indeks]);
}
if (view == jawabD){
jawabD.setImageResource(pilihD[indeks]);
}
if (view == btn_next){
Intent start = new Intent(mquiz.this, samplequiz.class);
startActivity(start);
}
}
java

add a comment |
Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??
- if the dominant answer is A then the result is A
- if the dominant answer is B then the result is B
- if the dominant answer is C then the result is C
- if the dominant answer is D then the result is D
if A is equal to B, C, D then the result is E
the choice of using imagebutton and 6 questions
the result I have typed in string.xml what is the code so that each result declaration is called ... ??
please help me
----under this my code, how do the statements for the formula above:-----
public class mquiz extends Activity implements View.OnClickListener{
Button btn_next;
ImageButton jawabA, jawabB, jawabC, jawabD;
TextView question;
String kuisioner ={"Your hobbies..??","Which object do you like...??"};
//Pilihan Gambar
int pilihA ={R.drawable.seeing, R.drawable.picture};
int pilihB ={R.drawable.singing, R.drawable.songer};
int pilihC ={R.drawable.readwrite, R.drawable.writestory};
int pilihD ={R.drawable.activity, R.drawable.football};
private int indeks;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_quiz);
setContentView(R.layout.menu_quiz1);
question=(TextView)findViewById(R.id.question);
question.setText(kuisioner[0]);
jawabA=(ImageButton)findViewById(R.id.pilihanA);
jawabA.setImageResource(pilihA[0]);
jawabA.setOnClickListener(this);
jawabB=(ImageButton)findViewById(R.id.pilihanB);
jawabB.setImageResource(pilihB[0]);
jawabB.setOnClickListener(this);
jawabC=(ImageButton)findViewById(R.id.pilihanC);
jawabC.setImageResource(pilihC[0]);
jawabC.setOnClickListener(this);
jawabD=(ImageButton)findViewById(R.id.pilihanD);
jawabD.setImageResource(pilihD[0]);
jawabD.setOnClickListener(this);
}
@Override
public void onClick(View view){
indeks++;
if (view == jawabA){
jawabA.setImageResource(pilihA[indeks]);
}
if (view == jawabB){
jawabB.setImageResource(pilihB[indeks]);
}
if (view == jawabC){
jawabC.setImageResource(pilihC[indeks]);
}
if (view == jawabD){
jawabD.setImageResource(pilihD[indeks]);
}
if (view == btn_next){
Intent start = new Intent(mquiz.this, samplequiz.class);
startActivity(start);
}
}
java

1
I recommend reading up on the equals method, instead of running all your comparisons with referential comparisons. also: add else-keywords where applicable, it'll make your code a tad more efficiënt
– Stultuske
Nov 20 '18 at 13:08
retrieve the results in string.xml, how do I ... ?? what is typed in java.class or xml. can give the sample code for my problem...?? I can later learn specific.
– Maulana Syam
Nov 22 '18 at 7:09
you are making mistakes against the basics which have a big impact on your code, and you don't seem to be aware of naming conventions, yet you are trying to write (more) advanced code. don't. learn the basics first
– Stultuske
Nov 22 '18 at 7:11
I want to make a multiple personality quiz test and later the result is text taken in string.xml.
– Maulana Syam
Nov 22 '18 at 7:28
add a comment |
Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??
- if the dominant answer is A then the result is A
- if the dominant answer is B then the result is B
- if the dominant answer is C then the result is C
- if the dominant answer is D then the result is D
if A is equal to B, C, D then the result is E
the choice of using imagebutton and 6 questions
the result I have typed in string.xml what is the code so that each result declaration is called ... ??
please help me
----under this my code, how do the statements for the formula above:-----
public class mquiz extends Activity implements View.OnClickListener{
Button btn_next;
ImageButton jawabA, jawabB, jawabC, jawabD;
TextView question;
String kuisioner ={"Your hobbies..??","Which object do you like...??"};
//Pilihan Gambar
int pilihA ={R.drawable.seeing, R.drawable.picture};
int pilihB ={R.drawable.singing, R.drawable.songer};
int pilihC ={R.drawable.readwrite, R.drawable.writestory};
int pilihD ={R.drawable.activity, R.drawable.football};
private int indeks;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_quiz);
setContentView(R.layout.menu_quiz1);
question=(TextView)findViewById(R.id.question);
question.setText(kuisioner[0]);
jawabA=(ImageButton)findViewById(R.id.pilihanA);
jawabA.setImageResource(pilihA[0]);
jawabA.setOnClickListener(this);
jawabB=(ImageButton)findViewById(R.id.pilihanB);
jawabB.setImageResource(pilihB[0]);
jawabB.setOnClickListener(this);
jawabC=(ImageButton)findViewById(R.id.pilihanC);
jawabC.setImageResource(pilihC[0]);
jawabC.setOnClickListener(this);
jawabD=(ImageButton)findViewById(R.id.pilihanD);
jawabD.setImageResource(pilihD[0]);
jawabD.setOnClickListener(this);
}
@Override
public void onClick(View view){
indeks++;
if (view == jawabA){
jawabA.setImageResource(pilihA[indeks]);
}
if (view == jawabB){
jawabB.setImageResource(pilihB[indeks]);
}
if (view == jawabC){
jawabC.setImageResource(pilihC[indeks]);
}
if (view == jawabD){
jawabD.setImageResource(pilihD[indeks]);
}
if (view == btn_next){
Intent start = new Intent(mquiz.this, samplequiz.class);
startActivity(start);
}
}
java

Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??
- if the dominant answer is A then the result is A
- if the dominant answer is B then the result is B
- if the dominant answer is C then the result is C
- if the dominant answer is D then the result is D
if A is equal to B, C, D then the result is E
the choice of using imagebutton and 6 questions
the result I have typed in string.xml what is the code so that each result declaration is called ... ??
please help me
----under this my code, how do the statements for the formula above:-----
public class mquiz extends Activity implements View.OnClickListener{
Button btn_next;
ImageButton jawabA, jawabB, jawabC, jawabD;
TextView question;
String kuisioner ={"Your hobbies..??","Which object do you like...??"};
//Pilihan Gambar
int pilihA ={R.drawable.seeing, R.drawable.picture};
int pilihB ={R.drawable.singing, R.drawable.songer};
int pilihC ={R.drawable.readwrite, R.drawable.writestory};
int pilihD ={R.drawable.activity, R.drawable.football};
private int indeks;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu_quiz);
setContentView(R.layout.menu_quiz1);
question=(TextView)findViewById(R.id.question);
question.setText(kuisioner[0]);
jawabA=(ImageButton)findViewById(R.id.pilihanA);
jawabA.setImageResource(pilihA[0]);
jawabA.setOnClickListener(this);
jawabB=(ImageButton)findViewById(R.id.pilihanB);
jawabB.setImageResource(pilihB[0]);
jawabB.setOnClickListener(this);
jawabC=(ImageButton)findViewById(R.id.pilihanC);
jawabC.setImageResource(pilihC[0]);
jawabC.setOnClickListener(this);
jawabD=(ImageButton)findViewById(R.id.pilihanD);
jawabD.setImageResource(pilihD[0]);
jawabD.setOnClickListener(this);
}
@Override
public void onClick(View view){
indeks++;
if (view == jawabA){
jawabA.setImageResource(pilihA[indeks]);
}
if (view == jawabB){
jawabB.setImageResource(pilihB[indeks]);
}
if (view == jawabC){
jawabC.setImageResource(pilihC[indeks]);
}
if (view == jawabD){
jawabD.setImageResource(pilihD[indeks]);
}
if (view == btn_next){
Intent start = new Intent(mquiz.this, samplequiz.class);
startActivity(start);
}
}
java

java

edited Nov 20 '18 at 13:18
Sergey Glotov
16.8k117288
16.8k117288
asked Nov 20 '18 at 13:06


Maulana SyamMaulana Syam
42
42
1
I recommend reading up on the equals method, instead of running all your comparisons with referential comparisons. also: add else-keywords where applicable, it'll make your code a tad more efficiënt
– Stultuske
Nov 20 '18 at 13:08
retrieve the results in string.xml, how do I ... ?? what is typed in java.class or xml. can give the sample code for my problem...?? I can later learn specific.
– Maulana Syam
Nov 22 '18 at 7:09
you are making mistakes against the basics which have a big impact on your code, and you don't seem to be aware of naming conventions, yet you are trying to write (more) advanced code. don't. learn the basics first
– Stultuske
Nov 22 '18 at 7:11
I want to make a multiple personality quiz test and later the result is text taken in string.xml.
– Maulana Syam
Nov 22 '18 at 7:28
add a comment |
1
I recommend reading up on the equals method, instead of running all your comparisons with referential comparisons. also: add else-keywords where applicable, it'll make your code a tad more efficiënt
– Stultuske
Nov 20 '18 at 13:08
retrieve the results in string.xml, how do I ... ?? what is typed in java.class or xml. can give the sample code for my problem...?? I can later learn specific.
– Maulana Syam
Nov 22 '18 at 7:09
you are making mistakes against the basics which have a big impact on your code, and you don't seem to be aware of naming conventions, yet you are trying to write (more) advanced code. don't. learn the basics first
– Stultuske
Nov 22 '18 at 7:11
I want to make a multiple personality quiz test and later the result is text taken in string.xml.
– Maulana Syam
Nov 22 '18 at 7:28
1
1
I recommend reading up on the equals method, instead of running all your comparisons with referential comparisons. also: add else-keywords where applicable, it'll make your code a tad more efficiënt
– Stultuske
Nov 20 '18 at 13:08
I recommend reading up on the equals method, instead of running all your comparisons with referential comparisons. also: add else-keywords where applicable, it'll make your code a tad more efficiënt
– Stultuske
Nov 20 '18 at 13:08
retrieve the results in string.xml, how do I ... ?? what is typed in java.class or xml. can give the sample code for my problem...?? I can later learn specific.
– Maulana Syam
Nov 22 '18 at 7:09
retrieve the results in string.xml, how do I ... ?? what is typed in java.class or xml. can give the sample code for my problem...?? I can later learn specific.
– Maulana Syam
Nov 22 '18 at 7:09
you are making mistakes against the basics which have a big impact on your code, and you don't seem to be aware of naming conventions, yet you are trying to write (more) advanced code. don't. learn the basics first
– Stultuske
Nov 22 '18 at 7:11
you are making mistakes against the basics which have a big impact on your code, and you don't seem to be aware of naming conventions, yet you are trying to write (more) advanced code. don't. learn the basics first
– Stultuske
Nov 22 '18 at 7:11
I want to make a multiple personality quiz test and later the result is text taken in string.xml.
– Maulana Syam
Nov 22 '18 at 7:28
I want to make a multiple personality quiz test and later the result is text taken in string.xml.
– Maulana Syam
Nov 22 '18 at 7:28
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393670%2fresult-java-choice-solution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393670%2fresult-java-choice-solution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
I recommend reading up on the equals method, instead of running all your comparisons with referential comparisons. also: add else-keywords where applicable, it'll make your code a tad more efficiënt
– Stultuske
Nov 20 '18 at 13:08
retrieve the results in string.xml, how do I ... ?? what is typed in java.class or xml. can give the sample code for my problem...?? I can later learn specific.
– Maulana Syam
Nov 22 '18 at 7:09
you are making mistakes against the basics which have a big impact on your code, and you don't seem to be aware of naming conventions, yet you are trying to write (more) advanced code. don't. learn the basics first
– Stultuske
Nov 22 '18 at 7:11
I want to make a multiple personality quiz test and later the result is text taken in string.xml.
– Maulana Syam
Nov 22 '18 at 7:28