I am attempting to create a "control array" similar to that of Visual Basic 6. And I have no clue as how to implement such within Android's Java language. I am really trying to implement a click listener for an object array within a for-loop.
Here is an example of code I attempted yet continues to cause errors:
for(final int i = 1; i <= 7; i++){
imgSkill.setOnLongClickListener(new OnLongClickListener(){
public boolean onLongClick(View v){
intCurrentImage = i - 7;
new AlertDialog.Builder(SoldierActivity.this)
.setTitle(strSkillTitle[i + (intCurrentTab * 7)])
.setMessage(strSkillDescription[i + (intCurrentTab * 7)])
.setNeutralButton("Close", null)
.setPositiveButton("Reset", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which){
intSkills[intCurrentTab][intCurrentImage] = 0;
updateLayout();
}
})
.show();
return true;
}
});
}
Here is an example of code I attempted yet continues to cause errors:
for(final int i = 1; i <= 7; i++){
imgSkill.setOnLongClickListener(new OnLongClickListener(){
public boolean onLongClick(View v){
intCurrentImage = i - 7;
new AlertDialog.Builder(SoldierActivity.this)
.setTitle(strSkillTitle[i + (intCurrentTab * 7)])
.setMessage(strSkillDescription[i + (intCurrentTab * 7)])
.setNeutralButton("Close", null)
.setPositiveButton("Reset", new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialog, int which){
intSkills[intCurrentTab][intCurrentImage] = 0;
updateLayout();
}
})
.show();
return true;
}
});
}