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 6995713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:03:54+00:00 2026-05-27T20:03:54+00:00

Ok, so I just recently got into this Android app development using Eclipse for

  • 0

Ok, so I just recently got into this Android app development using Eclipse for fun over this winter break, so forgive me if this is a very easy question.

I have so far an app where it asks a question (I create the questions in the program) and the user types the answer and hits submit, pretty simple. My problem is, how do I get the app to go onto the next question? Here is what i have so far:

package first.project;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
//import java.util.Random;

public class FirstProjectActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Champion ahri = new Champion(0, "Ahri", "I am a Mage", false);
    Champion akali = new Champion(1, "Akali", "Ninja stuff", true);
    Champion alistar = new Champion(2, "Alistar", "I am a cow", false);
    final LinkedList champions = new LinkedList();
    champions.insert(ahri);
    champions.insert(akali);
    champions.insert(alistar);
    question = (TextView) findViewById(R.id.question);
    txtname = (EditText) findViewById(R.id.txt_name);
    blah = (Button) findViewById(R.id.btn_clickme);
    quit = (Button) findViewById(R.id.quit);
    quit.setOnClickListener(new View.OnClickListener() {
        public void onClick(View v) {
            finish();
        }
    });
    Champion tmp;
    //Random randomGenerator = new Random();
    //int randomNumber = randomGenerator.nextInt(2);
    //tmp = champions.find(randomNumber);
    /*while (tmp.hasBeenCalled) {
        randomNumber = randomGenerator.nextInt(2);
        tmp = champions.find(randomNumber);
    }*/
    /*tmp.hasBeenCalled = true;
    while (tmp.name == null) {
        Toast.makeText(getBaseContext(), "You have completed the quiz!", Toast.LENGTH_SHORT);
        blah.setOnClickListener(new View.OnClickListener() {            
            public void onClick(View v) {
                // TODO Auto-generated method stub
                Toast.makeText(getBaseContext(), "You have completed the quiz!", Toast.LENGTH_SHORT);
            }
        });
    }*/
    tmp = champions.getFirst();
   // while (tmp.name != null); {
        question.setText(tmp.says);
        final Champion temp = tmp;
        blah.setOnClickListener(new View.OnClickListener() {            
            public void onClick(View v) {
                // TODO Auto-generated method stub
                String str1 = txtname.getText().toString();
                if (champions.isCorrect(temp.name, str1)) {
                    Toast.makeText(getBaseContext(), getString(R.string.correct), Toast.LENGTH_SHORT).show();
                }
                else 
                    Toast.makeText(getBaseContext(), getString(R.string.incorrect), Toast.LENGTH_SHORT).show();
            }
        });
        //tmp.hasBeenCalled = true;
        tmp = champions.getNext();
        //question.setText(tmp.says);
   // }

}

private EditText txtname;
private Button blah;
private Button quit;
private TextView question;    
}

Ok, so I have a Link and LinkedList and Champions .java file and all that. My problem is, when I try to loop (the while loop that is commented out) it just breaks the app, nothing shows up when I simulate it. But I don’t know how else to get the next Question onto the page. Do I have to create a screen for each question? Do I have to write each question out over and over? Any help is appreciated. Sorry if i am not very clear. (and the code, I really am a pac rat even when I code, I dont like to delete code until I for sure know I won’t need it).

  • 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-27T20:03:55+00:00Added an answer on May 27, 2026 at 8:03 pm

    Your while loops are most likely blocking the UI thread. This will cause your app to not respond and hang/force close/crash.

    You will want to refactor your code to not use blocking while loops.

    Try simply displaying the question then acting on the event of a user giving the answer (I don’t know if that will involve clicking a button or entering text or numbers in a box). If the answer is correct, get the next question and display it.

    You want to make your application more event driven, don’t wait around looping for an answer.

    I think this article may have some helpful tidbits: http://developer.android.com/guide/practices/design/responsiveness.html

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

Sidebar

Related Questions

I just recently got into using vim, and am having great fun adding load
I've recently been doing a lot of Objective-C programming, and just got back into
Just recently I dove into the VideoLAN open source project. This was my first
I have just recently run into an issue running an asp.net web app under
So i just recently got into canvas and decide to play around with it
I recently got into Silverlight development. So far I've managed to create a single
Just recently got into experimenting with NLog, and it occurs to me that I
Alright well I recently got into normalizing my database for this little side project
I just recently got my first mac. I do lots of programming on windows
I just recently got around to converting an old svn project to git. Everything

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.