安卓开发用这个为什么会出错?
下面这个按钮事件为什么点击会闪退呢?
public void ptsanmjs(View v)
{
ContentValues Values=new ContentValues();
ArrayList<String> a=new ArrayList<>();
ArrayList<String> b=new ArrayList<>();
Cursor cur= db.query("kaijianghaoma", null, "haoma", new String[]{}, null, null, "qihao asc");
Cursor shuju=ptsanm.query("putongsanma", null, "putong3haoma", new String[]{}, null, null, null);
while (shuju.moveToNext())
{
int name=shuju.getColumnIndex("putong3haoma");
String str=shuju.getString(name);
b.add(str);
}
while (cur.moveToNext())
{
int cname=cur.getColumnIndex("haoma");
String st=cur.getString(cname);
a.add(st);}
ArrayList<Integer> e = new ArrayList<Integer>();
for (String s1 : b)
{
int cnt = 0;
int cnt2=0;
List list1 = new ArrayList<String>(Arrays.asList(s1.split(",")));
for (String s2 : a)
{
List list2 = new ArrayList<String>(Arrays.asList(s2.split(",")));
List list3 = new ArrayList<String>(list1);
list3.retainAll(list2);
if (list3.size() == 0)
{
cnt++;
}
else
{
cnt = 0;
}
if (cnt > cnt2)
{
cnt2 = cnt;
e.add(cnt2);
}
}
int f=0;
for (int i=0;i < e.size();i++)
{
f += e.get(i);
}
int g=f / e.size();
Values.put("putong3zdpingjun", g);
Values.put("putong3zuida", cnt2);
Values.put("putong3dangqian", cnt);
ptsanm.update("putongsanma", Values, "putong3haoma=?", new String[]{s1});
}
}
...全文
相关推荐
IM安卓开发工具箱imakit9.13更新.zip
IM安卓开发工具箱imakit目前实现的功能: 制作刷机包 1、备份系统img镜像 2、脚本生成 3、刷机包格式转换 img-dat dat-br 等一系列的功能等你发现
android开发timeout出错的详解
Failed to install .apk on device 'emulator-5554': timeout
android签名出错的解决方法
android签名出错的解决方法 截图说明如何解决。
Eclipse开发Android时创建工程出错解决办法
仅为一般问题解决办法,不一定能完全解决
简单的安卓开发
新手值得一看的安卓开发程序,主要有登录、以及注册两个界面的布局,以及注册登录失败或成功提醒业务的实现


