アプリケーションのラベルを ListView に入れました。OnItemClickListener からpackageName (com.blabla.blabla)を取得したい。どうすればいいですか?ここに私のコード:
uygList = new ArrayList<String>();
final PackageManager pm = getPackageManager();
List<ApplicationInfo> paketler = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo paketBilgi : paketler) {
if (paketBilgi.packageName.equals(c.getString(0))) {
uygList.add(paketBilgi.loadLabel(pm).toString());
if (sayi<c.getCount()-1) {
sayi++;
c.moveToNext();
}
}
}
lv.setAdapter(new ArrayAdapter<String>(Uygulamalar.this, android.R.layout.simple_list_item_1, uygList));
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int pos, long id) {
// I want to get the packageName that selected from ListView like (com.blabla.blabla)
}
});