+ Reply to Thread
Results 1 to 2 of 2

Thread: listview control

  1. #1

    listview control

    Hi , I want to open an activity depends on the value user select on a ListView. If user select a list item that have type1 value it should open acitvity1 (activity1.class), if the list item belongs to type2 it should open acitvity2 (activity2.class).
    Code:
               @Override
            protected void onListItemClick(ListView l, View v, int position, long id) {
                super.onListItemClick(l, v, position, id);
    
                //TODO:need to assign the value here 
                String mEdit = .......;
    
                if (mEdit.equals("type1")){
                    Intent i = new Intent(this, activity1.class);
                    i.putExtra(DbAdapter.KEY_ROWID, id );
                    startActivityForResult(i, ACTIVITY_EDIT);
                }else if (mEdit.equals("type2")){
                    Intent i = new Intent(this, activity2.class);
                    i.putExtra(KEY_ROWIDA, id );
                    startActivityForResult(i, ACTIVITY_EDIT);
                };
    
                }

  2. #2
    Code:
    ForumDescriptor selected = (ForumDescriptor) getListView().getItemAtPosition(position);
    ForumDescriptor has some information about an individual subforum (it's a forums viewer for a website). Each one is an item in my list.

+ Reply to Thread

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts