Question: I am using SharedPreference to store the state of checkboxes but even i am storing true in it , its still retrieving false. 

Here is my code - 

```
@Override
public void onPause()
{
    super.onPause();
    saveState();
}

@Override
public void onResume()
{
    super.onResume();
    loadState();

}
@Override
public void onRestart()
{
    super.onRestart();
    loadState();
}

public void saveState()
{
    SharedPreferences sp = getPreferences(Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = sp.edit();
    for(int i = 0; i < itemCheck.length; i++)
    {
        Boolean b = itemCheck[i];
        Log.e(TAG, b.toString());
        editor.putBoolean(i+"", itemCheck[i]);
    }
}
public void loadState()
{
    SharedPreferences sp = getPreferences(Context.MODE_PRIVATE);
    for(int i = 0; i < itemCheck.length; i++)
    {

        itemCheck[i] = sp.getBoolean(i+"", false);
        Boolean b = itemCheck[i];
        Log.e(TAG, b.toString());
    }
    for(int i = 0; i < itemCheck.length; i++)
    {
        lv.setItemChecked(i, itemCheck[i]);
    }
}

```

Its giving me false because i set false as a default value in getBoolean which should be returned in the absence of predefined key. Please take a look and tell me what i did wrong. Thanks

Answer: 
I did something similar a while back.

Assuming that you want your images displayed in image\_id order you could do the following.

On the "next" link, you make a call to your PHP script with parameters that identify the category and the id and the direction you want to move.. eg

myserver.com/myapp/images.php?action=next&cat=holidaypics&image\_id=111

Then you can do a query to find the next highest image\_id with the same category by doing something like "select min(image\_id) from images where category\_id="holidaypics" and image\_id > 111"

If you're going in reverse you'd change the action to "prev" and do a query like this...

"select max(image\_id) from images where category\_id="holidaypics" and image\_id < 111"

Does that help?
Consider Ajax to load your container with images of a particular category.

It is as simple as saying HI