Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6827343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:15:17+00:00 2026-05-26T22:15:17+00:00

I’ve made a simple android quiz game for android 2.2 (sdk-8). Everything works perfectly

  • 0

I’ve made a simple android quiz game for android 2.2 (sdk-8).
Everything works perfectly on my emulator, but when I try using the app on my smart phone (android 2.2) it crashes on the 9th question.

  • 1-8 questions work perfectly on my smart phone (android 2.2)

  • after 8th (on 9th) it crashes (smart phone)

  • Everything works perfectly in my emulator, no crashes (Eclipse)

  • I am %120 sure Im using .apk I exported from my android project in eclipse

Any idea what’s wrong?

public class ETBetaActivity extends Activity implements View.OnClickListener {

    Button answer_1,
    answer_2,answer_3,
    answer_4,main;

    TextView q_textview,
    tip;

    private String a1,a2,a3,a4 = "";

    private int i1 = 0;
    public static int correct = 0;

    private boolean alive = true;

    MediaPlayer button_click;

    private String[] questions =
   {"Q1", 
    "Q2",
    "Q3", 
    "Q4",
    "Q5", //5
    "Q6", 
    "Q7", 
    "Q8", 
    "Q9", //CRASH!!!! WHAT THE FUDGE?!
    "Q10" //10
    };
    public static int question_amount = 10;
    private String[] answers_correct =
   {"Correct answer - 1",
    "Correct answer - 2",
    "Correct answer - 3", 
    "Correct answer - 4",
    "Correct answer - 5",
    "Correct answer - 6",
    "Correct answer - 7",
    "Correct answer - 8",
    "Correct answer - 9",
    "Correct answer - 10"
    };

    private String[][] answers_wrong = 
    { {"Q1-1", "Q1-2" , "Q1-3"},
      {"Q2-1", "Q2-2" , "Q2-3"},
      {"Q3-1", "Q3-2" , "Q3-3"},
      {"Q4-1", "Q4-2" , "Q4-3"},
      {"Q5-1", "Q5-2" , "Q5-3"},
      {"Q6-1", "Q6-2" , "Q6-3"},
      {"Q7-1", "Q7-2" , "Q7-3"},
      {"Q8-1", "Q8-2" , "Q8-3"},
      {"Q9-1", "Q9-2" , "Q9-3"},
      {"Q10-1", "Q10-2" , "Q10-3"}

    };


    List<String> question_list = new ArrayList<String>();
    List<String> answer_list_correct = new ArrayList<String>();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        getData();
        Game(i1);
    }


    @Override
    public void onClick(View view) {
        if (alive == false) {
        //  startActivity(new Intent("com.aleksei.etb.END"));
            return;
        }
        button_click = MediaPlayer.create(this, R.raw.button_click);
        button_click.start();
        switch(view.getId()){
        case R.id.button5: //main
            break;
        case R.id.button1: //answer_1
            if(isCorrect(1))
                correct++;


            break;
        case R.id.button2: //answer_2
            if(isCorrect(2))
                correct++;

            break;
        case R.id.button3: //answer_3
            if(isCorrect(3))
                correct++;

            break;
        case R.id.button4: //answer_3
            if(isCorrect(4))
                correct++;


            break;

        default:
            break;


        }
        Game(i1);
        //correct++;
        tip.setText("");
    }


    public static int getResults(){
        int value = (int) Math.floor((correct*5)/question_amount);
        if(value <= 0)
        return 1;
        else
        return value;
    }

    private boolean isCorrect(int button){
        for (int i = 0; i < answers_correct.length; i++){
        if(button == 1 && a1 == answers_correct[i]
            || button == 2 && a2 == answers_correct[i]
            || button == 3 && a3 == answers_correct[i]
            || button == 4 && a4 == answers_correct[i])
            return true;
        }
        return false; 
    }

    private void Game(int q){
        if(i1 == question_amount) { //no more questions
            startActivity(new Intent("com.aleksei.etb.END"));
            alive = false;
            return;
        }
        try {
        main.setText("Dunno");
    /*  String answer_list[][] = {
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]},
                {answers_correct[i1], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]}
        }; */
        String answer_list[] = {
        answers_correct[q], answers_wrong[q][0] , answers_wrong[q][1] , answers_wrong[q][2]     
        };

        Collections.shuffle(Arrays.asList(answer_list));
        answer_1.setText(answer_list[0]);
        answer_2.setText(answer_list[1]);
        answer_3.setText(answer_list[2]);
        answer_4.setText(answer_list[3]);
        a1 = answer_list[0];
        a2 = answer_list[1];
        a3 = answer_list[2];
        a4 = answer_list[3];
        q_textview.setText(questions[q]);
        /*questions = question_list.toArray(new String[question_list.size()]);
        answers_correct = answer_list_correct.toArray(new String[answer_list_correct.size()]);
        question.setText(questions[i1]);        

        answer_list_correct.remove(questions[i1]);
        question_list.remove(questions[i1]);*/
        } catch (Exception ex){}
        i1++;
    }
    private void getData(){
        //Getting the data
        main = (Button) findViewById(R.id.button5);
        answer_1 = (Button) findViewById(R.id.button1);
        answer_2 = (Button) findViewById(R.id.button2);
        answer_3 = (Button) findViewById(R.id.button3);
        answer_4 = (Button) findViewById(R.id.button4);
        q_textview = (TextView) findViewById(R.id.question);
        tip = (TextView) findViewById(R.id.answ1);

        //Making the buttons, actually work
        main.setOnClickListener(this);
        answer_1.setOnClickListener(this);
        answer_2.setOnClickListener(this);
        answer_3.setOnClickListener(this);
        answer_4.setOnClickListener(this);

        //Resets the text
        //Note to self: Replace with another ContectView
        main.setText("Begin!");
        answer_4.setText("");
        answer_3.setText("");
        answer_2.setText("");
        answer_1.setText("");
        tip.setText("");

    /*  for(String x : questions) {
            for(String y : answers_correct){

            answer_list_correct.add(y);
            question_list.add(x);

            Collections.shuffle(answer_list_correct);
            Collections.shuffle(question_list);

            }
        } */



    }


    }

End intent/class

public class End extends Activity implements RatingBar.OnRatingBarChangeListener {
   // ETBetaActivity classy = new ETBetaActivity();

    TextView score;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.end);
        score = (TextView) findViewById(R.id.score);
        results();
        final RatingBar yourRating = (RatingBar) findViewById(R.id.ratingBar1);
        yourRating.setRating(ETBetaActivity.getResults());
        Toast.makeText(End.this, "Score "+ETBetaActivity.getResults(), Toast.LENGTH_LONG).show();

         yourRating.setOnRatingBarChangeListener(new RatingBar.OnRatingBarChangeListener(){

            @Override
            public void onRatingChanged(RatingBar ratingBar, float rating,
              boolean fromUser) {
              //  yourRating.setRating(rating);
                yourRating.setRating(ETBetaActivity.getResults());
                Toast.makeText(End.this, "Score "+ETBetaActivity.getResults(), Toast.LENGTH_LONG).show();
            }});
     //movieImage.setImageResource(R.drawable.icon);       
    }




    @Override
    public void onRatingChanged(RatingBar ratingBar, float rating,
            boolean fromUser) {
        // TODO Auto-generated method stub

    }

    public void results(){
        score.setText("Your score  "+ETBetaActivity.getResults());
    }

    }

PS.
It’s not ‘END’ class causing the error, cause I’ve tried

if(i1 == 4)

To call it earlier, and it worked perfectly.

Best regards.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:15:17+00:00Added an answer on May 26, 2026 at 10:15 pm

    Are you sure that works on your emulator?
    I tried it on 2.3.3 device and it crashes after 10th question when trying to run
    startActivity(new Intent("com.aleksei.etb.END")).
    I changed it to startActivity(new Intent(this, End.class)) and it works fine.

    Btw, I had to remove lines with MediaPlayer initializing, as I don’t have your music file

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Seemingly simple, but I cannot find anything relevant on the web. What is the
We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.