Why does Android Studio enter the full path for some classes?

拥有回忆 提交于 2020-01-14 05:03:30

问题


I have the following code for creating a custom adapter and android studio is defaulting to the full path of my package. This was not always like this. I wonder what has changed. And it doesn't know what localNetView is even though is declare at the top of my class. Why does Android Studio do it like this? Without making any changes can't find the classes.

private ListView localNetListView;
private Adapter localNetAdapter;

localNetListView  = (ListView) findViewById(R.id.local_network);
localNetAdapter = new org.pctechtips.netdroid.HostAdapter(this, R.layout.list_main, localIfaceInfo);
localNetListView.setAdapter(localNetAdapter);

回答1:


Make sure the "Use fully qualified class names" option under File > Settings > Editor > Code Style > Java > Imports tab is unchecked.

If this is only happening to a file, check the imports manually and see if another class with the same name (and different package) is imported, and remove its import line.



来源:https://stackoverflow.com/questions/55499962/why-does-android-studio-enter-the-full-path-for-some-classes

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