How To Compare String With Arraylist
How to comapre value with arraylist? Form database below is my code. I just want to filter only that values which are present in the database. I just want to filter array list at t
Solution 1:
I just change a few bits in your array list.
for (int i = 0; i < packs.size(); i++) {
PackageInfo p = packs.get(i);
ApplicationInfo applicationInfo = p.applicationInfo;
String arrayval= arraylist.get(i).toString();
if (arrayval.equals(p.packageName))
{
App app = new App();
app.setTitle(p.applicationInfo.loadLabel(packageManager).toString());
app.setPackageName(p.packageName);
app.setVersionName(p.versionName);
app.setVersionCode(p.versionCode);
CharSequence description = p.applicationInfo.loadDescription(packageManager);
app.setDescription(description != null ? description.toString(): "");
apps.add(app);
}
}
You were trying to compare complete arrayList
with a String
hence that is NOT POSSIBLE
Post a Comment for "How To Compare String With Arraylist"