protected voID onItemClick(ListVIEw l,VIEw v,int position,long ID,AdapterVIEw<?> parent) { super.onListItemClick(l,v,position,ID); final ApplicationInfo app = appList.get(position); PackageInfo packageInfo = (PackageInfo) parent.getItemAtposition(position); AppDataActivity appData = (AppDataActivity) getApplicationContext(); appData.setPackageInfo(packageInfo); Intent appInfo = new Intent(getApplicationContext(),ApkInfoActivity.class); startActivity(appInfo); }
我找不到问题.我如何解决?
使用logcat编辑:
10-29 17:14:07.710: E/AndroIDRuntime(3535): FATAL EXCEPTION: main10-29 17:14:07.710: E/AndroIDRuntime(3535): java.lang.classCastException: androID.content.pm.ApplicationInfo cannot be cast to androID.content.pm.PackageInfo10-29 17:14:07.710: E/AndroIDRuntime(3535): at com.dd.application.MainActivity.onItemClick(MainActivity.java:369)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.Widget.AdapterVIEw.performItemClick(AdapterVIEw.java:297)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.Widget.AbsListVIEw.performItemClick(AbsListVIEw.java:1149)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.Widget.AbsListVIEw$PerformClick.run(AbsListVIEw.java:2939)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.Widget.AbsListVIEw.run(AbsListVIEw.java:3622)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.os.Handler.handleCallback(Handler.java:730)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.os.Handler.dispatchMessage(Handler.java:92)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.os.Looper.loop(Looper.java:137)10-29 17:14:07.710: E/AndroIDRuntime(3535): at androID.app.ActivityThread.main(ActivityThread.java:5323)10-29 17:14:07.710: E/AndroIDRuntime(3535): at java.lang.reflect.Method.invokeNative(Native Method)10-29 17:14:07.710: E/AndroIDRuntime(3535): at java.lang.reflect.Method.invoke(Method.java:525)10-29 17:14:07.710: E/AndroIDRuntime(3535): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:743)10-29 17:14:07.710: E/AndroIDRuntime(3535): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:559)10-29 17:14:07.710: E/AndroIDRuntime(3535): at dalvik.system.NativeStart.main(Native Method)解决方法 用这个做你的工作
List.setonItemClickListener(new AdapterVIEw.onItemClickListener() { @OverrIDe public voID onItemClick(AdapterVIEw<?> adapter,VIEw vIEw,long arg) { Intent appInfo = new Intent(YourActivity.this,ApkInfoActivity.class); startActivity(appInfo); } });总结
以上是内存溢出为你收集整理的android – 如何打开新的活动点击列表视图中的项目?全部内容,希望文章能够帮你解决android – 如何打开新的活动点击列表视图中的项目?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)