view cannot be resolved to a type

删除回忆录丶 提交于 2020-06-24 20:33:25

问题


what seems to be the problem with view here? how do i solve it?

the error "View cannot be resolved to a type"

public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {
    Object o = my_listview.getItemAtPosition(position);
    // write you handling code like...
    String st = "sdcard/";
    File f = new File(st+o.toString());
    // do whatever u want to do with 'f' File object
    Log.d("The position fo f:",o.toString());
    }

any ideas?


回答1:


You should import it. If you are using Eclipse, press Ctrl+Shift+o.




回答2:


import.view.View

Sometimes If the API level specified in your manifest is below API level 12 then eclipse does'nt suggest this import. Might be because its not supported. But you can manually insert the import. The functions that require a higher API level won't work.



来源:https://stackoverflow.com/questions/5512557/view-cannot-be-resolved-to-a-type

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