Bug with skiped packages fixed.

This commit is contained in:
Alexander Smorkalov 2012-12-06 14:11:30 +04:00
parent 4ebcf2b224
commit 257d8df1d4

View File

@ -173,6 +173,7 @@ public class ManagerActivity extends Activity
mInstalledPackageView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
//if (!mListViewItems.get((int) id).get("Name").equals("Built-in OpenCV library"));
if (!mInstalledPackageInfo[(int) id].packageName.equals("org.opencv.engine"))
{
mInstalledPackageView.setTag(Integer.valueOf((int)id));
@ -276,8 +277,12 @@ public class ManagerActivity extends Activity
mInstalledPackageInfo = mMarket.GetInstalledOpenCVPackages();
mListViewItems.clear();
for (int i = 0; i < mInstalledPackageInfo.length; i++)
int RealPackageCount = mInstalledPackageInfo.length;
for (int i = 0; i < RealPackageCount; i++)
{
if (mInstalledPackageInfo[i] == null)
break;
// Convert to Items for package list view
HashMap<String,String> temp = new HashMap<String,String>();
@ -289,7 +294,6 @@ public class ManagerActivity extends Activity
String PackageName = mInstalledPackageInfo[i].packageName;
String VersionName = mInstalledPackageInfo[i].versionName;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
NativeLibDir = mInstalledPackageInfo[i].applicationInfo.nativeLibraryDir;
else
@ -306,8 +310,14 @@ public class ManagerActivity extends Activity
VersionName = NativeInfo.versionName();
}
else
{
mInstalledPackageInfo[i] = mInstalledPackageInfo[RealPackageCount-1];
mInstalledPackageInfo[RealPackageCount-1] = null;
RealPackageCount--;
i--;
continue;
}
}
int idx = 0;
Log.d(TAG, PackageName);