How open new activity clicking an item in listview?

前端 未结 10 2087
我在风中等你
我在风中等你 2020-11-30 10:17

I can\'t start a new activity clicking over an item in my listview. I want that onItemClick can open the ApkInfoActivity.. Actually when i click no

10条回答
  •  死守一世寂寞
    2020-11-30 10:47

    for instance if u want to open an activity based on the text u click in listview,ie if "abcd" is the option clicked on the listview and u want to open the activity with the very same name "abcd",then perform this ..

    public void onItemClick(AdapterView parent, View view, int position,
            long id) {
    
        String temp=yourarray[position];
    
    
        try{
            Class myclass=Class.forName("yourpackagename."+temp);
            Intent in=new Intent(this,myclass);
            startActivity(in);
            }catch(Exception e){
    
            }
    
    
    }
    

提交回复
热议问题