闪退,断点跑到 SimpleAdapter加载ArrayList>数据就跳出去了

m0_37748860 2018-05-25 05:11:55
Handler JobsHandler = new Handler(){
@Override
public void handleMessage(Message msg){
//textReceive.append((msg.obj).toString());

Bundle bundle=msg.getData();
ArrayList llist=bundle.getParcelableArrayList("llist");
final ArrayList<Map<String,Object>> Mylist=
(ArrayList<Map<String,Object>>) llist.get(0);//需要强制转换list类型
data=Mylist;
SimpleAdapter adapter = new SimpleAdapter(SecondActivity.this,
data,
R.layout.listview_item,
new String[]{"jobid", "orderno"},
new int[]{R.id.tv_userName, R.id.tv_msg});
mListView.setAdapter(adapter);
}
};
主界面如下图,包含4个ViewPager页。mListView.setAdapter(adapter)跑完就闪退。求救哪里出问题了。
...全文
1479 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
m0_37748860 2018-05-28
  • 打赏
  • 举报
回复
没贴全 ,有个左右的翻页控件,可能和这个有关吧? OnCreate(){ BottomBar bottomBar = findViewById(R.id.bottom_bar); bottomBar.setContainer(R.id.fl_container) .setTitleBeforeAndAfterColor("#999999", "#ff5d5e") .addItem(Fragment1.class, "首页", R.drawable.item1_before, R.drawable.item1_after) .addItem(Fragment2.class, "其他", R.drawable.item2_before, R.drawable.item2_after) .addItem(Fragment3.class, "我的", R.drawable.item3_before, R.drawable.item3_after) .build(); }
m0_37748860 2018-05-28
  • 打赏
  • 举报
回复
引用 8 楼 w452828297 的回复:
logcat 贴出来
05-28 10:26:58.386 20879-20879/? I/art: Late-enabling -Xcheck:jni 05-28 10:26:58.477 20879-20879/com.example.bottombar W/ActivityThread: Application com.example.bottombar is waiting for the debugger on port 8100... 05-28 10:26:58.483 20879-20879/com.example.bottombar I/System.out: Sending WAIT chunk 05-28 10:26:58.594 20879-20885/com.example.bottombar I/art: Debugger is active 05-28 10:26:58.684 20879-20879/com.example.bottombar I/System.out: Debugger has connected 05-28 10:26:58.684 20879-20879/com.example.bottombar I/System.out: waiting for debugger to settle... 05-28 10:26:58.884 20879-20879/com.example.bottombar I/System.out: waiting for debugger to settle... 05-28 10:26:59.085 20879-20879/com.example.bottombar I/System.out: waiting for debugger to settle... 05-28 10:26:59.285 20879-20879/com.example.bottombar I/System.out: waiting for debugger to settle... 05-28 10:26:59.486 20879-20879/com.example.bottombar I/System.out: waiting for debugger to settle... 05-28 10:26:59.686 20879-20879/com.example.bottombar I/System.out: waiting for debugger to settle... 05-28 10:26:59.886 20879-20879/com.example.bottombar I/System.out: waiting for debugger to settle... 05-28 10:27:00.087 20879-20879/com.example.bottombar I/System.out: debugger has settled (1316) 05-28 10:27:00.102 20879-20879/com.example.bottombar W/System: ClassLoader referenced unknown path: /data/app/com.example.bottombar-2/lib/arm 05-28 10:27:00.107 20879-20879/com.example.bottombar I/LoadedApk: No resource references to update in package com.yulong.android 05-28 10:27:00.157 20879-20879/com.example.bottombar W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 05-28 10:27:00.207 20879-20879/com.example.bottombar V/BoostFramework: mAcquireFunc method = public int com.qualcomm.qti.Performance.perfLockAcquire(int,int[]) 05-28 10:27:00.208 20879-20879/com.example.bottombar V/BoostFramework: mReleaseFunc method = public int com.qualcomm.qti.Performance.perfLockRelease() 05-28 10:27:00.208 20879-20879/com.example.bottombar V/BoostFramework: mAcquireTouchFunc method = public int com.qualcomm.qti.Performance.perfLockAcquireTouch(android.view.MotionEvent,android.util.DisplayMetrics,int,int[]) 05-28 10:27:00.208 20879-20879/com.example.bottombar V/BoostFramework: mIOPStart method = public int com.qualcomm.qti.Performance.perfIOPrefetchStart(int,java.lang.String) 05-28 10:27:00.208 20879-20879/com.example.bottombar V/BoostFramework: mIOPStop method = public int com.qualcomm.qti.Performance.perfIOPrefetchStop() 05-28 10:27:00.213 20879-20879/com.example.bottombar V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@7270af0 05-28 10:27:00.213 20879-20879/com.example.bottombar V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@694f869 05-28 10:27:00.409 20879-20904/com.example.bottombar D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 05-28 10:27:00.505 20879-20904/com.example.bottombar I/Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: EGL 1.4 QUALCOMM build: Nondeterministic_AU_msm8909_LA.BR.1.2.7_RB1__release_AU (I7d704ff208) OpenGL ES Shader Compiler Version: E031.29.00.00 Build Date: 10/24/16 Mon Local Branch: Remote Branch: quic/LA.BR.1.2.7_rb1.34 Local Patches: NONE Reconstruct Branch: NOTHING 05-28 10:27:00.508 20879-20904/com.example.bottombar I/OpenGLRenderer: Initialized EGL, version 1.4 05-28 10:27:02.403 20879-20919/com.example.bottombar W/System.err: Mon May 28 10:27:02 GMT+08:00 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 05-28 10:27:02.903 20879-20879/com.example.bottombar V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@9b5bc95 05-28 10:27:02.904 20879-20879/com.example.bottombar V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@214e1aa [ 05-28 10:27:03.011 20879:20920 W/ ] Zip: Invalid filename 05-28 10:27:03.077 20879-20923/com.example.bottombar W/System.err: Mon May 28 10:27:03 GMT+08:00 2018 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. 05-28 10:27:03.197 20879-20923/com.example.bottombar I/System.out: [{jobid=57, orderno=1220180510001}, {jobid=58, orderno=5620180510001}, {jobid=60, orderno=3420180511001}, {jobid=62, orderno=4520180511001}, {jobid=64, orderno=6720180510001}]
m0_37748860 2018-05-28
  • 打赏
  • 举报
回复
引用 7 楼 zhang106209 的回复:
报错贴出来看看
引用 9 楼 w452828297 的回复:
SecondActivity这个代码也贴出来
主要涉及代码: updatejobs获取数据库数据,bundle传值显示到listview protected void onCreate(Bundle savedInstanceState) { mListView=(ListView)findViewById(R.id.listView); updateJobs(); } Handler JobsHandler = new Handler(){ @Override public void handleMessage(Message msg){ //textReceive.append((msg.obj).toString()); Bundle bundle=msg.getData(); ArrayList llist=bundle.getParcelableArrayList("llist"); final ArrayList<Map<String,Object>> Mylist= (ArrayList<Map<String,Object>>) llist.get(0);//需要强制转换list类型 data=Mylist; //创建adapter SimpleAdapter adapter = new SimpleAdapter(SecondActivity.this, data, R.layout.listview_item, new String[]{"jobid", "orderno"}, new int[]{R.id.tv_userName, R.id.tv_msg}); mListView.setAdapter(adapter); 这一步跑完闪退 } }; private void updateJobs() { new Thread(new Runnable() { @Override public void run() { String sql = "select jobid,orderno from jobs where userid='" + StaticValue.UserInfo.UserId + "'"; //HashMap<String, String> mp = DBUtils.Query(sql); try { List<Map<String, Object>> mp=DBUtil.executeQuery(sql); System.out.println(mp); if(mp!=null) { Bundle bundle=new Bundle(); Message message=new Message(); ArrayList llist=new ArrayList();//ArrayList 继承自ParcelableArrayList llist.add(mp);//Mylist是List<Map<String,Object>>类型的对象 bundle.putParcelableArrayList("llist", llist); //bundle.putString("result", result); // bundle.putInt("position", position); message.what=0; message.setData(bundle); JobsHandler.sendMessage(message); } } catch (SQLException e) { e.printStackTrace(); } } }).start(); }
Rabbit47 2018-05-26
  • 打赏
  • 举报
回复
SecondActivity这个代码也贴出来
Rabbit47 2018-05-25
  • 打赏
  • 举报
回复
logcat 贴出来
zhang106209 2018-05-25
  • 打赏
  • 举报
回复
报错贴出来看看
m0_37748860 2018-05-25
  • 打赏
  • 举报
回复
引用 5 楼 zhang106209 的回复:
你不用debug会报错吗?
这个操作是获取数据,在app启动后自动执行,直接闪退
zhang106209 2018-05-25
  • 打赏
  • 举报
回复
你不用debug会报错吗?
m0_37748860 2018-05-25
  • 打赏
  • 举报
回复
引用 3 楼 zhang106209 的回复:
错误的代码贴出来看看
就是上面的代码,断点跑没有错误提示,跑完就闪退,注释掉就不崩了。
m0_37748860 2018-05-25
  • 打赏
  • 举报
回复
help help
m0_37748860 2018-05-25
  • 打赏
  • 举报
回复
zhang106209 2018-05-25
  • 打赏
  • 举报
回复
错误的代码贴出来看看

80,362

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧