android listview onItemClickListener failed

不羁岁月 提交于 2019-12-24 00:38:38

问题


i use the following code to listener my listview onItemClick Events. no compile error occurred ,

and nothing happened when i clicked any list item , i don't why Orz

could someone tell me why @@?

mp3_listView.setOnItemClickListener(new OnItemClickListener() 
        { 
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2 , long arg3) { 
                Toast.makeText(tabDigTest.this , arg2+" ", Toast.LENGTH_SHORT);
            }
        });

回答1:


You need to call show on the Toast object then only it'll be shown.

Toast.makeText(tabDigTest.this , arg2+" ", Toast.LENGTH_SHORT).show();


来源:https://stackoverflow.com/questions/3734290/android-listview-onitemclicklistener-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!