我使用下面的代码来检测 ZXing条码扫描器,但是有异常:ClassNotFoundException。
try{
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
startActivityForResult(intent, 0);
}
catch(Exception e)
{
//调用 Alert message 来下载程序
}
ClassNotFoundException说com.google.zxing.client.android.CaptureActivity不能找到。但是我把已经在try,catch 模块中放置了呀。为什么这个异常没有处理呢?
catch (ClassNotFoundException e)
{
}
加上看看呢
要查询是否有这个应用, 而不是捕捉异常
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
List<ResolveInfo> list = getPackageManager().queryIntentActivities( intent, 0 );
list.size() > 0 ,说明存在目标应用
没找到那个类?
是不是你在SRC下面没这个类!