Guest User

The final product

a guest
Jan 25th, 2015
9,564
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Other stuff up here
  2.  
  3. public class Quotebook extends Activity {
  4.  
  5.     int count = 0;
  6.  
  7.     @Override
  8.     protected void onCreate(Bundle savedInstanceState) {
  9.         super.onCreate(savedInstanceState);
  10.         setContentView(R.layout.activity_quotebook);
  11.  
  12.         RelativeLayout touch = (RelativeLayout) findViewById(R.id.touch);
  13.         final TextView quoteText = (TextView) findViewById(R.id.quote);
  14.         final TextView personText = (TextView) findViewById(R.id.person);
  15.  
  16.         final ArrayList<Quote> quoteList = new ArrayList<Quote>();
  17.  
  18.         Quote quote4 = new Quote("You're more of a fun vampire. You don't suck blood, you just suck.", "Troy Barnes");
  19.         quoteList.add(quote4);
  20.  
  21.         Quote quote1 = new Quote("Cool Beans", "Rod Kimble");
  22.         quoteList.add(quote1);
  23.  
  24.         Quote quote2 = new Quote("How can mirrors be real if our eyes aren't real", "Jaden Smith");
  25.         quoteList.add(quote2);
  26.  
  27.         Quote quote3 = new Quote("That's like me blaming owls for how bad I suck at analogies.", "Britta Perry");
  28.         quoteList.add(quote3);
  29.  
  30.         Quote quote5 = new Quote("I was gonna be the first person in my family to graduate from community college. Everyone else graduated from normal college", "Troy Barnes");
  31.         quoteList.add(quote5);
  32.  
  33.         //Add more quotes here
  34.  
  35.  
  36.         touch.setOnClickListener(new View.OnClickListener() {
  37.             @Override
  38.             public void onClick(View view) {
  39.  
  40.                 if (count < quoteList.size()) {
  41.  
  42.                     Quote q = quoteList.get(count);
  43.  
  44.                     quoteText.setText(q.getQuote());
  45.  
  46.                     personText.setText(q.getPerson());
  47.  
  48.                     count = count + 1;
  49.  
  50.  
  51.                 } else{
  52.  
  53.                     count = 0;
  54.  
  55.                 }
  56.  
  57.  
  58.  
  59.  
  60.             }
  61.         });
  62.  
  63.     }
  64.  
  65.  
  66. //Other stuff down here
RAW Paste Data