view cannot be resolved to a type

2020-07-02 10:26发布

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?

2条回答
太酷不给撩
2楼-- · 2020-07-02 11:19

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

查看更多
\"骚年 ilove
3楼-- · 2020-07-02 11:27

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.

查看更多
登录 后发表回答