我偶然发现了一个我现在弄不清楚的问题。当我将一个包传递给一个新的活动时,我得到一个索引越界异常。android indexoutofboundsexception通过意图传递包
我使用下面的代码:
Intent intent = new intent(this, statelistactivity.class);
Bundle bundle = new bundle();
Bundle.putInt("id", _id);
Bundle.putString("name", _name);
Intent.putExtras(bundle);
startactivity(intent);
在我使用接收活动:
String name = getIntent().getString("name);
以下为INT同样的原则。
但是我的代码从来没有到达这里,因为outofboundsexception
。什么会造成这种情况?
发布您的LogCat输出。 –
据我所知,outofbounds异常通常会在有数组或列表时出现,并且您正在尝试访问一个不在此数组范围内的iten – 2011-10-04 07:56:15
我不认为这个代码甚至编译了 – Caner