我的 OnItemClick
方法中有这个。
final String[] links = getResources().getStringArray(R.array.pokemon_stats);
String content = links[position];
Intent showContent = new Intent(getApplicationContext(),
PokedexViewActivity.class);
showContent.setData(content);
startActivity(showContent);
它不喜欢我有 .setData(content)。我相信 setData 是针对 URI 的。我要为字符串数组做什么?这是我悬停时的确切错误。 Intent 类型中的方法 setData(Uri) 不适用于参数 (String)
我把它切换到这个,但我无法获得宠物小 Sprite 的统计数据:
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
final String[] links = getResources().getStringArray(R.array.pokemon_stats);
String content = links[position];
Intent showContent = new Intent(getApplicationContext(),
PokedexViewActivity.class);
Bundle extras = getIntent().getExtras();
String pokeStats = extras.getString("MarcsString");
showContent.putExtra(pokeStats, content);
startActivity(showContent);
最佳答案
使用showContent.putExtra("key", value);
关于android - 显示字符串数组的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7000985/