• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android Gridview Increment Issue need help :0

  • Thread starter Thread starter Deleted User
  • Start date Start date
D

Deleted User

Guest
Hi New member here, I am currently making a value game with a grid view. here's the code that is causing me problems, basically when the user selects each value in order a counter is incremented and I check to see if the counter is over the Array that is set within the grid meaning the user has finished the game.

**GameCounter is an int that is first set to 0
**Max is an int which is the size of the array that is set into the grid

gridView.setOnItemClickListener(new OnItemClickListener()
{
@Override public void onItemClick(AdapterView<?> arg0, View arg1, int val, long arg3)
{
if(val == gameCounter)
{ gameCounter++; //Increment Further
}
if(gameCounter > max)
{ Toast.makeText(getApplicationContext(), "Congrats you finished the game" , Toast.LENGTH_SHORT).show(); }
}
});
}
Currently however the app stays stagnant and no toast appears once I select each value in order :( I'm quite new to android development so any help would be really appreciated :D. As i seem to keep struggling with this issue. Apologies for the code not being formatted correctly forgive a newbie :P
 
Back
Top Bottom