How to build string for opening new activity
<p>I am trying to make a simple program that could open a new activity when tapping a item on a list. To save some codeing I tried this:</p>

<pre><code>package info.test.htas;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;

public class xfelt extends ListActivity {

String[] bygning = getResources().getStringArray(R.array.bygning_array);

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    setContentView(R.layout.xfelt); 
    ListView lv = (ListView)findViewById(R.id.xfelt);
    lv.setAdapter(new ArrayAdapter&lt;String&gt;(
            this, android.R.layout.simple_list_item_1, 
            bygning));
}


@Override
protected void onListItemClick(ListView l, View v, int position, long id) {

    if("Byg. 1".equals(bygning[position]))
        {startActivity(byg1.class);}
    else if("Byg. 2".equals(bygning[position]))
        {startActivity(byg2.class);}
    else if("Byg. 3".equals(bygning[position]))
    {startActivity(byg3.class);}
    else if("Byg. 4".equals(bygning[position]))
    {startActivity(byg4.class);}
    else if("Byg. 5".equals(bygning[position]))
    {startActivity(byg5.class);}        
}


}
</code></pre>

<p>But the compiler won't recognize the <code>startActivity</code> function. How come?</p>

<p>Peter</p>
