我的代码将包名从.txt
文件填充到ListView中,并且我希望单击时在Google Play商店中打开每个列表项。如何获取列表项(包名)?如何在列表视图中获取列表项的位置?
startActivity(new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://play.google.com/store/apps/details?id="
+ "com.utorrent.client")));
我的列表视图:
try {
String filePath = Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/vers.txt";
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(filePath), "Cp1252"), 100);
String line;
ArrayList<String> lines = new ArrayList<String>();
while ((line = br.readLine()) != null) {
lines.add(line);
}
br.close();
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, lines);
listView1.setAdapter(adapter);
} catch (Exception e) {
e.printStackTrace();
}
}
也许你应该在你的'ListView' – Karakuri