Qanday qilib men ro'yxatdagi ko'rinadigan tugmachani boshqa bir faoliyatga yo'naltirishim mumkin?

Ro'yxat ko'rinishidagi ma'lumotlarimni boshqa bir faoliyatga bog'lashni istayman, shuning uchun men ro'yxatni ko'rish elementini bosish bilan boshqa narsalarga o'tishim mumkin.

0

2 javoblar

Bunday tarzda foydalaning

setListAdapter(new ArrayAdapter(this, android.R.layout.simple_expandable_list_item_1, Categories));
    ListView lv = getListView();
    lv.setTextFilterEnabled(true);
    lv.setOnItemClickListener(new OnItemClickListener() {
      public void onItemClick(AdapterView<?> parent, View v,int position, long id) {

          switch (position){
          case 0: Intent animalsGridViewIntent = new Intent(ListOfAppGallery.this,AnimalsGridView.class);     
                  ListOfAppGallery.this.startActivity(animalsGridViewIntent);
                  break;
          case 1: Intent calenderGridViewIntent = new Intent(ListOfAppGallery.this,CalenderGridView.class);     
                  ListOfAppGallery.this.startActivity(calenderGridViewIntent);
                  break;
          case 2: Intent carsGridViewIntent = new Intent(ListOfAppGallery.this,CarsGridView.class);     
                  ListOfAppGallery.this.startActivity(carsGridViewIntent);
                  break;
          }
      }
  });    
1
qo'shib qo'ydi
rahmat polamReddy.it ishladi.
qo'shib qo'ydi muallif sumit pandey, manba
xush kelibsiz dude ...
qo'shib qo'ydi muallif RajaReddy PolamReddy, manba

Ro'yxat uchun list.setOnItemClickListener (this); ro'yxatini qo'shing va implment OnItemClickListener uchun bir faoliyat uchun.

va ushbu usulni boshqa faoliyatga o'tkazib yubormang:

@Override

 public void onItemClick(AdapterView<?> arg0, View v, final int position,long arg3) 
  {
  Intent in=new Intent(YourActivity.this,NewClass.class);
            startActivity(in);
             finish();

  }

Sizga kerakli joyni tekshiring

0
qo'shib qo'ydi