how to show another List View


Last Updated:

  1. soclose

    soclose New Member This Topic's Starter

    Joined:
    Apr 4, 2010
    Messages:
    2
    Likes Received:
    0
    Hi

    I'd like to show another List View 'B' after clicking a item of List View 'A'. I use onListItemClick event in Android 1.6 project.

    Code (Text):
    1. public void onListItemClick(
    2.             ListView parent, View v,
    3.             int position, long id)
    4.             {  
    5.                 Toast.makeText(this,
    6.                     "You have selected " + lv_arr[position],
    7.                     Toast.LENGTH_SHORT).show();
    8.             }  
    how to code it? :confused:
     

    Advertisement
  2. jon21569

    jon21569 Member

    Joined:
    Aug 10, 2008
    Messages:
    23
    Likes Received:
    7
    You can launch a new activity and show the new list there.

    public void onListItemClick( ListView parent, View v, int position, long id)
    {
    final Intent i = new Intent(this, NewListActivity.class);
    startActivity(i);
    }
     
  3. soclose

    soclose New Member This Topic's Starter

    Joined:
    Apr 4, 2010
    Messages:
    2
    Likes Received:
    0
    I got 'Source not found' error.

    Code (Text):
    1.  
    2. public void onListItemClick(
    3.             ListView parent, View v,
    4.             int position, long id)
    5.             {  
    6.                 final Intent i = new Intent(this, WLView.class);
    7.                 startActivity(i);
    8.             }
    9.  
    how to solve?:(
     

Share This Page

Loading...