Result java choice solution












0















Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??




  1. if the dominant answer is A then the result is A

  2. if the dominant answer is B then the result is B

  3. if the dominant answer is C then the result is C

  4. if the dominant answer is D then the result is D


  5. 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);
}
}









share|improve this question




















  • 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
















0















Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??




  1. if the dominant answer is A then the result is A

  2. if the dominant answer is B then the result is B

  3. if the dominant answer is C then the result is C

  4. if the dominant answer is D then the result is D


  5. 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);
}
}









share|improve this question




















  • 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














0












0








0








Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??




  1. if the dominant answer is A then the result is A

  2. if the dominant answer is B then the result is B

  3. if the dominant answer is C then the result is C

  4. if the dominant answer is D then the result is D


  5. 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);
}
}









share|improve this question
















Sorry, if I ask, can anyone help my Android project if the quiz formula results like this ... ??




  1. if the dominant answer is A then the result is A

  2. if the dominant answer is B then the result is B

  3. if the dominant answer is C then the result is C

  4. if the dominant answer is D then the result is D


  5. 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 android arrays






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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














  • 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












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
});


}
});














draft saved

draft discarded


















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
















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

Npm cannot find a required file even through it is in the searched directory