انجمن سایت کلیدستان


رتبه موضوع:
  • 0 رای - 0 میانگین
  • 1
  • 2
  • 3
  • 4
  • 5
custom Listview و رفتن به یه اکتیوتی دیگه

custom Listview و رفتن به یه اکتیوتی دیگه

#1
سلام 
چگونه میشه  با کلیک بر روی هر ایتم  custom Listview رفت به یه اکتیوتی دیگه


کد:
public class ListmusicActivity extends ListActivity {

    private static final ListView AdaptereMan = null;




    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_listmusic);
        
    
        setListAdapter (new AdaptereMan (this,
                android.R.layout.simple_list_item_1, R.id.textView1, getResources ().getStringArray(R.array.listahang)));
        
        
    }
    
    
    @SuppressLint("ViewHolder")
    private class AdaptereMan extends ArrayAdapter <String> {

         public AdaptereMan(Context context, int resource, int textViewResourceId, String[] strings) {
            super(context, resource, textViewResourceId, strings);
            }
            @Override
            public View getView (int makan, View convertView, ViewGroup parent) {
                
                LayoutInflater bazkonande = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
               View radif = bazkonande.inflate(R.layout.listax, parent, false);
                String [] radifha = getResources ().getStringArray(R.array.listahang);
                ImageView tasvir = (ImageView) radif.findViewById(R.id.imageView1);
                TextView matn = (TextView) radif.findViewById(R.id.textView1);
                matn.setText (radifha[makan]);
                if (makan == 0)
                    tasvir.setImageResource(R.drawable.adeleh1);
                
                else if (makan == 1)
                    tasvir.setImageResource(R.drawable.celine);
                else if (makan == 2)
                    tasvir.setImageResource(R.drawable.hqdefault);
                return radif;
                }
            }
        

    
    

}
پاسخ


پیام‌های این موضوع
custom Listview و رفتن به یه اکتیوتی دیگه - توسط tejint - ۱۳۹۵/۰۳/۰۱, ۰۲:۴۸ ب.ظ
RE: custom Listview و رفتن به یه اکتیوتی دیگه - توسط T.I.T - ۱۳۹۵/۰۳/۰۱, ۰۴:۰۱ ب.ظ
RE: custom Listview و رفتن به یه اکتیوتی دیگه - توسط tejint - ۱۳۹۵/۰۳/۰۱, ۰۴:۳۲ ب.ظ
RE: custom Listview و رفتن به یه اکتیوتی دیگه - توسط tejint - ۱۳۹۵/۰۳/۰۱, ۰۸:۰۴ ب.ظ
RE: custom Listview و رفتن به یه اکتیوتی دیگه - توسط kingtaha - ۱۳۹۵/۰۳/۰۲, ۰۱:۳۲ ب.ظ

پرش به انجمن:


کاربران در حال بازدید این موضوع: 1 مهمان