r.java不生成ListView,它引用另一个项目中的另一个ListView

时间:2013-04-22 17:21:16

标签: android listview android-xml r.java-file

列表视图未在r.java中声明我清理并构建了应用程序,但它不起作用。 我甚至删除了r.java并在没有ListView的情况下重新生成了它。

问题

当我将android:id="@android:id/listv"更改为android:id="@+id/listv"时,我使用r.java来声明XML文件。 它在ListView中声明,但遗憾的是出现了许多错误。我认为Eclipse正在查看另一个项目中的其他04-22 17:36:48.253: E/ActivityThread(674): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0cdc8 that was originally bound here 04-22 17:36:48.253: E/ActivityThread(674): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0cdc8 that was originally bound here 04-22 17:36:48.253: E/ActivityThread(674): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-22 17:36:48.253: E/ActivityThread(674): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-22 17:36:48.253: E/ActivityThread(674): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-22 17:36:48.253: E/ActivityThread(674): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-22 17:36:48.253: E/ActivityThread(674): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-22 17:36:48.253: E/ActivityThread(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-22 17:36:48.253: E/ActivityThread(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-22 17:36:48.253: E/ActivityThread(674): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 04-22 17:36:48.253: E/ActivityThread(674): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 04-22 17:36:48.253: E/ActivityThread(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-22 17:36:48.253: E/ActivityThread(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-22 17:36:48.253: E/ActivityThread(674): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-22 17:36:48.253: E/ActivityThread(674): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-22 17:36:48.253: E/ActivityThread(674): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-22 17:36:48.253: E/ActivityThread(674): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-22 17:36:48.253: E/ActivityThread(674): at java.lang.Thread.run(Thread.java:856) 04-22 17:36:48.304: E/StrictMode(674): null 04-22 17:36:48.304: E/StrictMode(674): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0cdc8 that was originally bound here 04-22 17:36:48.304: E/StrictMode(674): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-22 17:36:48.304: E/StrictMode(674): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-22 17:36:48.304: E/StrictMode(674): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-22 17:36:48.304: E/StrictMode(674): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-22 17:36:48.304: E/StrictMode(674): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-22 17:36:48.304: E/StrictMode(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-22 17:36:48.304: E/StrictMode(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-22 17:36:48.304: E/StrictMode(674): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 04-22 17:36:48.304: E/StrictMode(674): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 04-22 17:36:48.304: E/StrictMode(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-22 17:36:48.304: E/StrictMode(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-22 17:36:48.304: E/StrictMode(674): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-22 17:36:48.304: E/StrictMode(674): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-22 17:36:48.304: E/StrictMode(674): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-22 17:36:48.304: E/StrictMode(674): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-22 17:36:48.304: E/StrictMode(674): at java.lang.Thread.run(Thread.java:856) 04-22 17:36:48.304: W/ActivityManager(288): Unbind failed: could not find connection for android.os.BinderProxy@40f77040 04-22 17:36:48.323: E/ActivityThread(674): Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0d680 that was originally bound here 04-22 17:36:48.323: E/ActivityThread(674): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0d680 that was originally bound here 04-22 17:36:48.323: E/ActivityThread(674): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-22 17:36:48.323: E/ActivityThread(674): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-22 17:36:48.323: E/ActivityThread(674): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-22 17:36:48.323: E/ActivityThread(674): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-22 17:36:48.323: E/ActivityThread(674): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-22 17:36:48.323: E/ActivityThread(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-22 17:36:48.323: E/ActivityThread(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-22 17:36:48.323: E/ActivityThread(674): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 04-22 17:36:48.323: E/ActivityThread(674): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 04-22 17:36:48.323: E/ActivityThread(674): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 04-22 17:36:48.323: E/ActivityThread(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-22 17:36:48.323: E/ActivityThread(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-22 17:36:48.323: E/ActivityThread(674): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-22 17:36:48.323: E/ActivityThread(674): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-22 17:36:48.323: E/ActivityThread(674): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-22 17:36:48.323: E/ActivityThread(674): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-22 17:36:48.323: E/ActivityThread(674): at java.lang.Thread.run(Thread.java:856) 04-22 17:36:48.354: E/StrictMode(674): null 04-22 17:36:48.354: E/StrictMode(674): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection com.android.emailcommon.service.ServiceProxy$ProxyConnection@40d0d680 that was originally bound here 04-22 17:36:48.354: E/StrictMode(674): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 04-22 17:36:48.354: E/StrictMode(674): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 04-22 17:36:48.354: E/StrictMode(674): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 04-22 17:36:48.354: E/StrictMode(674): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 04-22 17:36:48.354: E/StrictMode(674): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 04-22 17:36:48.354: E/StrictMode(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 04-22 17:36:48.354: E/StrictMode(674): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 04-22 17:36:48.354: E/StrictMode(674): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 04-22 17:36:48.354: E/StrictMode(674): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 04-22 17:36:48.354: E/StrictMode(674): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 04-22 17:36:48.354: E/StrictMode(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 04-22 17:36:48.354: E/StrictMode(674): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 04-22 17:36:48.354: E/StrictMode(674): at android.os.AsyncTask$2.call(AsyncTask.java:287) 04-22 17:36:48.354: E/StrictMode(674): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 04-22 17:36:48.354: E/StrictMode(674): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 04-22 17:36:48.354: E/StrictMode(674): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 04-22 17:36:48.354: E/StrictMode(674): at java.lang.Thread.run(Thread.java:856) ,其id列表无论如何都是logcat

编辑: 在XML中更改声明后

这是logcat

{{1}}

1 个答案:

答案 0 :(得分:2)

例外显然是Your content must have a ListView whose id attribute is 'android.R.id.list'

当您使用ListActivity时会发生这种情况,您的listView应该具有id @android:id/list所以

为xml

中的android:id="@android:id/list"设置ID ListView