Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Have no idea whats Wrong(Need Help with a script)
Have no idea whats Wrong [message #1244473] Wed, 12 February 2014 11:43 Go to next message
Super EvilKiwi is currently offline Super EvilKiwiFriend
Messages: 1
Registered: February 2014
Junior Member
Im new here so if I did anything wrong please say so.
I used a tutorial to creat this script but some how after removing every error there was the APP still crashed using the AVD Manager.

package de.hendrock.quiz;

import de.hendrock.quiz.R;
import android.os.Bundle;
import android.view.View;

import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class Best_App_EU extends Activity {

	public int currentQuestion;
	    public String [] questions; 
	    public String [] answers;
	    public Button answerButton;
	    public Button questionButton; 
	    public TextView questionView;
	    public TextView answerView;
	    public EditText answerText;
   public void onCreate(Bundle savedInstanceState) {
    public void init() {
    	questions = new String[]{"What is the capital of Egypt?",
    "What class are you in right now?"};
    	answers = new String[]{"Cairo","IST380"};
    	currentQuestion = -1;
    	answerButton = (Button)findViewById(;
    	questionButton = (Button)findViewById(;
    	questionView = (TextView) findViewById(; 
    	answerView = (TextView) findViewById(; 
    	answerText = (EditText) findViewById(;
    	answerButton.setOnClickListener(new OnClickListener(){
    	public void onClick(View v) { checkAnswer();
    	questionButton.setOnClickListener(new OnClickListener(){  	
    	public void onClick(View v) { showQuestion();
    	}}); }
    	public void showQuestion()
    	if(currentQuestion == questions.length)
    		currentQuestion =0;
    public boolean isCorrect(String answer)
     return (answer.equalsIgnoreCase(answers[currentQuestion])); 
  public void checkAnswer() 
	  String answer = answerText.getText().toString();
		  answerView.setText("You're right!");
		  answerView.setText("Sorry, the correct answer is" +

[Updated on: Wed, 12 February 2014 13:38] by Moderator

Report message to a moderator

Re: Have no idea whats Wrong [message #1244536 is a reply to message #1244473] Wed, 12 February 2014 13:38 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
These forums are for discussing Eclipse, but this is a question about general Android programming. You should ask on an Android-specific forum instead.
Previous Topic:Using Data Source Explorer Connection
Next Topic:Standalone Files in Eclipse
Goto Forum:

Current Time: Wed Oct 21 19:57:00 GMT 2020

Powered by FUDForum. Page generated in 0.03095 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top