Android: how do i switch from one activity to another by clicking items from the ListView
<p>i have made menu list containing play, settings, exit. but clicking the button doesn take me to the desired activity the listner is not working..can any one help me solve the problem.. will b thankfull..
yes its a list view control..</p>

<p>there are two errors in my code one is that
@@ The type new AdapterView.OnItemClickListener(){} must implement the inherited abstract method AdapterView.OnItemClickListener.onItemClick(AdapterView, View, int, long)@@ in LINE1</p>

<p>And the other one is @@ View cannot be resolved to a type@@ in LINE 2
"Actually i want to  shift from one screen to another when i click on the item in main menu screen"</p>

<p><strong>Here is the code of main menu</strong></p>

<p>public class MenuActivity extends Activity {</p>

<pre><code>/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.menu);
    ListView menuList=(ListView)findViewById(R.id.list);
    String[]items={getResources().getString(R.string.pla),
    getResources().getString(R.string.sco),
    getResources().getString(R.string.set),
    getResources().getString(R.string.hel),
    getResources().getString(R.string.qui)};
    ArrayAdapter&lt;String&gt; adapt = new ArrayAdapter&lt;String&gt;(this,R.layout.menu_items, items);
    menuList.setAdapter(adapt);
    menuList.setOnItemClickListener(new AdapterView.OnItemClickListener(){ //LINE 1 error 
        public void onItemClick(AdapterView&lt;?&gt; parent , View itemClicked, //LINE 2 error
        int position, long id) {
        TextView textView = (TextView) itemClicked;
        String strText = textView.getText().toString();
        if (strText.equalsIgnoreCase(getResources().getString(
        R.string.pla))) {
        // Game
        startActivity(new Intent(MenuActivity.this,
        GameActivity.class));}
        else if (strText.equalsIgnoreCase(getResources().getString(
        R.string.hel))) {
        // Help
        startActivity(new Intent(MenuActivity.this,
        HelpActivity.class));}
        else if (strText.equalsIgnoreCase(getResources().getString(
        R.string.set))) {
        //Settings 
        startActivity(new Intent(MenuActivity.this,
        SettingsActivity.class));}
        else if (strText.equalsIgnoreCase(getResources().getString(
        R.string.sco))) {
        //  Scores 
        startActivity(new Intent(MenuActivity.this,
        ScoresActivity.class));
        }
        }
        });
}
</code></pre>

<p>}</p>
