Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 17th, 2012  |  syntax: None  |  size: 0.95 KB  |  hits: 21  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Android: Split function not working
  2. package com.example.splitfunction;
  3.  
  4. import android.app.Activity;
  5. import android.os.Bundle;
  6. import android.widget.TextView;
  7.  
  8. public class SplitFunction extends Activity {
  9.     /** Called when the activity is first created. */
  10.     @Override
  11.     public void onCreate(Bundle savedInstanceState) {
  12.         super.onCreate(savedInstanceState);
  13.         TextView tv = new TextView(this);
  14.         String url = "http://mysub.somedomain.com/tabletcms/tablets/youcontent/000002/thumbnails/110/png";
  15.         String[] values;
  16.         int x = 0;
  17.  
  18.         tv.setText("SPLIT FUNCTION PROGRAM...n");
  19.         tv.append(url);
  20.  
  21.         values = url.split("/");
  22.  
  23.         while( x < values.length ){
  24.             tv.append("n" + x + ":> " + values[x]);
  25.             x++;
  26.         }
  27.  
  28.         setContentView(tv);
  29.     }
  30. }
  31.        
  32. tv.append("n" + x + ":> " + values[x++]);
  33.        
  34. while( x < values.length ){
  35.         tv.append("n" + x + ":> " + values[x]);
  36.         x++
  37.     }