Android Open Source - Crystal-Ball- Crystal Ball






From Project

Back to project page Crystal-Ball-.

License

The source code is released under:

Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECI...

If you think the Android project Crystal-Ball- listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sabersoft.crystalball;
/*  w ww  . j a v a2 s .com*/
import java.util.Random;

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

//CREATE A METHOD THAT CAN BE ACCESSED FROM DIFFERENT CLASSES
//DIFFERENT TYPES OF VARIABLES (INTEGERS, STRINGS, ARRAYS) 
//CONVERTING STRING TO INTEGER AND VICE-VERSA + RANDOMGENERATOR 
//CONVERTING STRING TO RANDOM ARRAY VALUE 






public class CrystalBall {
  
// CREATE A METHOD THAT CAN BE ACCESSED FROM DIFFERENT CLASSES
  
  public String getAnAnswer()
  {
    
// DIFFERENT TYPES OF VARIABLES (INTEGERS, STRINGS, ARRAYS) 
    
        final String testString = "Testing String"; 
        final int testInt = 1234; 
        final String[] answers = 
          {
            "It is certain", "It is not certain", "It is doubtful"
          };
            
// CONVERTING STRING TO INTEGER AND VICE-VERSA + RANDOMGENERATOR 
// CONVERTING STRING TO RANDOM ARRAY VALUE 
            
            String answer = ""; 
            Random randomGenerator = new Random(); 
            int randomNumber = randomGenerator.nextInt(answers.length);
            answer = answers[randomNumber];
            //answer = Integer.toString(randomNumber); 
            //answerLabel.setText(testString + "" + testInt);
            //answerLabel.setText(String.valueOf(randomNumber));
            return answer; 
  
            
  }
}




Java Source Code List

com.sabersoft.crystalball.CrystalBall.java
com.sabersoft.crystalball.MainActivity.java
com.sabersoft.crystalball.ShakeDetector.java