title: Array String Declaration
body: <p>I have a frustrating issue which could be easy. Arrays in java seem to be frustratingly not intuitive.</p>
  
  <p>I have an String array called title it has several titles</p>
  
  <p>here is part of the array</p>
  
  <pre><code>    private String[] title = {
          "Abundance",
          "Anxiety",
          "Bruxism",
          "Discipline",
          "Drug Addiction"
      }
  </code></pre>
  
  <p>This part seems OK in as the code compiles and runs just fine
  now I want to create another array BASED on this array.
  the new arrays will be made static text concatenated with data from this array and then more static text.</p>
  
  <p>I define the two static strings</p>
  
  <pre><code>    String urlbase = "http://www.somewhere.com/data/";
      String imgSel = "/logo.png";
  </code></pre>
  
  <p>so i added the declaration for the new array</p>
  
  <pre><code>    String[] mStrings;
  </code></pre>
  
  <p>and then I create a basic for loop to iterate through and create the elements of the new array</p>
  
  <pre><code>    for(int i=0;i&lt;title.length;i++) {
          mStrings[i] = urlbase + title[i].replaceAll("[^a-zA-Z]", "").toLowerCase() + imgSel;
      }
  </code></pre>
  
  <p>the loop takes the array value and strips out non alpha chars and makes it lowercase
  thus </p>
  
  <p>Drug Addiction</p>
  
  <p>becomes </p>
  
  <p>drugaddiction</p>
  
  <p>I want to end up with something like this</p>
  
  <pre><code>mStrings[0]="http://www.somewhere.com/data/abundance/logo.png"
  mStrings[1]="http://www.somewhere.com/data/anxiety/logo.png"
  mStrings[2]="http://www.somewhere.com/data/bruxism/logo.png"
  mStrings[3]="http://www.somewhere.com/data/discipline/logo.png"
  mStrings[4]="http://www.somewhere.com/data/drugaddiction/logo.png"
  </code></pre>
  
  <p>I tried several different attempts at declaring mStrings but all were incorrect
  when I leave it out Eclipse suggests this</p>
  
  <pre><code> String[] mStrings; 
  </code></pre>
  
  <p>Now this seems like it should be fairly easy and correct but when I enter anything after it
  I get an error that says </p>
  
  <pre><code> Syntax error on token ";", { expected after this token
  </code></pre>
  
  <p>Since it is one to one with the other array I tried this in the declaration but it also fails</p>
  
  <pre><code>    String[] mStrings[title.length];  
  </code></pre>
  
  <p>just to give it a quantity</p>
  
  <p>I am thinking the error is someplace in the declaration but I can't seem to find any docs that lay it out clearly.</p>
  
  <p>It seems like it is expecting not only a declaration but also loading of the array to occur which is what I do not want but I also tried loading it with three elements but it still didn't work right</p>
  
  <p>As I stated though I want to load it in the for loop</p>
  
  <p>Any help will be appreciated.</p>
  
  <p>I did try to set the array size but got the same error</p>
  
  <p>here is the exact code</p>
  
  <p>maybe it is elsewhere</p>
  
  <pre><code>import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.ListView;
  
  public class MainActivity extends Activity {
  
  ListView list;
  LazyAdapter adapter;
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      list=(ListView)findViewById(R.id.list);
      adapter=new LazyAdapter(this, mStrings);
      list.setAdapter(adapter);
  
      Button b=(Button)findViewById(R.id.button1);
      b.setOnClickListener(listener);
  }
  
  @Override
  public void onDestroy()
  {
      list.setAdapter(null);
      super.onDestroy();
  }
  
  public OnClickListener listener=new OnClickListener(){
  
      public void onClick(View arg0) {
          adapter.imageLoader.clearCache();
          adapter.notifyDataSetChanged();
      }
  };
  
  
  private String[] title = {
          "Abundance",
          "Anxiety",
          "Bruxism",
          "Discipline",
          "Drug Addiction"
  }
  
  
  String urlbase = "http://imobilize.s3.amazonaws.com/giovannilordi/data/";
  String imgSel = "/logo.png";    
  String[] mStrings = new String[title.length];
  </code></pre>
  
  <p>ERROR SHOWS HERE</p>
  
  <pre><code>for(int i=0;i&lt;title.length;i++) {
      mStrings[i] = urlbase + title[i].replaceAll("[^a-zA-Z]", "").toLowerCase() + imgSel;
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/FeUSx.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FeUSx.png" alt="screenshot of error in eclipse"></a><br>
  <sub>(source: <a href="http://www.imobilizeit.com/_errorshot/errorshot.png" rel="noreferrer">imobilizeit.com</a>)</sub>  </p>