Skip to main content
added 1157 characters in body
Source Link
NightSkyCode
  • 1.1k
  • 2
  • 16
  • 33
package me.me.quote;


public class Startme extends Activity {
 Random gen= new Random();
int num;

 String[] quotes = new String[15];


  
 
    
public void backnext(View BN){
         quotes[0]= "Love is timeless";
            quotes[1]= "I hate you";
            quotes[2]= "arggg!";
            quotes[3]= "The end is near";
            quotes[4]= "Leave be";

            if(num == 5){
                num =0;}
          
        
       
           TextView text = (TextView) findViewById(R.id.Quote);
           text.setText(quotes[num--]quotes[num++]);

and here is my next button

public void next         
           
          
           TextView number = (ViewTextView) NfindViewById(R.id.Qn){;
quotes[0]= "Love is timeless";
         number.setText(""+num);
    quotes[1]= "I hate you";    
        }
public void back(View B){

 quotes[0]= "Love quotes[2]=is "arggg!";timeless";
   quotes[1]= "I hate you";
   quotes[2]= "arggg!";
   quotes[3]= "The end is near";
   quotes[4]= "Leave be";

 TextView text = (TextView) findViewById(R.id.Quote);
 text.setText(quotes[num--]);

 TextView number quotes[4]== "Leave(TextView) be";
findViewById(R.id.Qn);
    number.setText(""+num);}
  

    

  public void ifrand(View G)  {

 num === gen.nextInt(5){;
     
  quotes[0]= "Love is timeless";
  quotes[1]= "I hate you";
  numquotes[2]= =0;}
"arggg!";
  quotes[3]= "The end is near";
  quotes[4]= "Leave be";
  TextView text = (TextView) findViewById(R.id.Quote);
  text.setText(quotes[num]);

TextView number = (TextView) findViewById(R.id.Qn);
number.setText(""+num);     text    
}


@Override
public void onCreate(Bundle savedInstanceState) {
    super.setTextonCreate(quotes[num++]savedInstanceState);
    this.setContentView(R.layout.startquotes);

    TextView Dark=(TextView)findViewById(R.id.Quote); 
    Typeface face=Typeface.createFromAsset(getAssets(), "fonts/font1.ttf");  
    Dark.setTypeface(face); 
    
        
}


}

please help! ive been searching for hours

public void back(View B){
 quotes[0]= "Love is timeless";
   quotes[1]= "I hate you";
   quotes[2]= "arggg!";
   quotes[3]= "The end is near";
   quotes[4]= "Leave be";  

 TextView text = (TextView) findViewById(R.id.Quote);
 text.setText(quotes[num--]);

and here is my next button

public void next(View N){
quotes[0]= "Love is timeless";
            quotes[1]= "I hate you";
            quotes[2]= "arggg!";
            quotes[3]= "The end is near";
            quotes[4]= "Leave be";

            if(num == 5){
                num =0;}

           TextView text = (TextView) findViewById(R.id.Quote);
           text.setText(quotes[num++]);
           

please help! ive been searching for hours

package me.me.quote;


public class Startme extends Activity {
 Random gen= new Random();
int num;

 String[] quotes = new String[15];


  
 
    
public void next(View N){
         quotes[0]= "Love is timeless";
            quotes[1]= "I hate you";
            quotes[2]= "arggg!";
            quotes[3]= "The end is near";
            quotes[4]= "Leave be";

            if(num == 5){
                num =0;}
          
        
       
           TextView text = (TextView) findViewById(R.id.Quote);
           text.setText(quotes[num++]);
           
           
          
           TextView number = (TextView) findViewById(R.id.Qn);
            number.setText(""+num);
           
        }
public void back(View B){

 quotes[0]= "Love is timeless";
   quotes[1]= "I hate you";
   quotes[2]= "arggg!";
   quotes[3]= "The end is near";
   quotes[4]= "Leave be";

 TextView text = (TextView) findViewById(R.id.Quote);
 text.setText(quotes[num--]);

 TextView number = (TextView) findViewById(R.id.Qn);
    number.setText(""+num);}
  

    

  public void rand(View G)  {

 num = gen.nextInt(5);
     
  quotes[0]= "Love is timeless";
  quotes[1]= "I hate you";
  quotes[2]= "arggg!";
  quotes[3]= "The end is near";
  quotes[4]= "Leave be";
  TextView text = (TextView) findViewById(R.id.Quote);
  text.setText(quotes[num]);

TextView number = (TextView) findViewById(R.id.Qn);
number.setText(""+num);         
}


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.startquotes);

    TextView Dark=(TextView)findViewById(R.id.Quote); 
    Typeface face=Typeface.createFromAsset(getAssets(), "fonts/font1.ttf");  
    Dark.setTypeface(face); 
    
        
}


}
Source Link
NightSkyCode
  • 1.1k
  • 2
  • 16
  • 33

Android Quote app, next and back buttons

Im trying to make a simple quote app, but every time I hit my back button after my next button it will go to the next array and not backwards. Im using an int num to keep track of with quote the user is on. here is my back button

public void back(View B){
 quotes[0]= "Love is timeless";
   quotes[1]= "I hate you";
   quotes[2]= "arggg!";
   quotes[3]= "The end is near";
   quotes[4]= "Leave be";  

 TextView text = (TextView) findViewById(R.id.Quote);
 text.setText(quotes[num--]);

and here is my next button

public void next(View N){
quotes[0]= "Love is timeless";
            quotes[1]= "I hate you";
            quotes[2]= "arggg!";
            quotes[3]= "The end is near";
            quotes[4]= "Leave be";

            if(num == 5){
                num =0;}

           TextView text = (TextView) findViewById(R.id.Quote);
           text.setText(quotes[num++]);
           

please help! ive been searching for hours

default