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
. As i seem to keep struggling with this issue. Apologies for the code not being formatted correctly forgive a newbie 
**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
. As i seem to keep struggling with this issue. Apologies for the code not being formatted correctly forgive a newbie 