1. Check out our companion app, Forums for Android! Download from Google Play

how to show another List View

Discussion in 'Application Development' started by soclose, Apr 4, 2010.

  1. soclose

    soclose New Member
    Thread Starter
    5

    Apr 4, 2010
    2
    0
    5
    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? :thinking:
     

    Advertisement

  2. jon21569

    jon21569 Member
    16

    Aug 10, 2008
    23
    7
    16
    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
    Thread Starter
    5

    Apr 4, 2010
    2
    0
    5
    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...