在 Android 应用程序中,我想为第一个和第二个按钮分配不同的标签(在你按下任何一个按钮之后)。我的代码如下。LogCat 向我展示了它执行一次内部 for 循环,然后关闭 VM 并给出消息"threadid=1: thread exists with uncaught exception (group=0x409961f8)"。谢谢你的帮助。
int marked = 0;
int i = 0;
int a = i + 1;
for ( i = 0; i < priorities.size(); i++ )
{
Log.d(TAG, "Setting button one tag: " + i );
Log.d(TAG, "blablabla rank2 " + priorities.get(i).rank);
button_one.setTag(i);
button_one.setText(priorities.get(i).name);
for (a = i + 1; a <= priorities.size(); a++)
{
Log.d(TAG, "Setting whilee: " + i );
Log.d(TAG, "blablabla while " + priorities.get(i).rank);
button_two.setTag(a);
button_two.setText(priorities.get(a).name);
}
}