Right way to save String and Drawable resources in sqlite?
<p>I have Spinner or ListView with flag icon and currency name (I save their <em>R</em> ids in sqlite, for example <em>R.drawable.aed</em> and <em>R.string.aed</em> from drawable folder and <em>string.xml</em>)</p>

<p>Then I insert new drawable, for example cxx.png</p>

<p>My flag icons shifts, some of them changes with other images, not flags icons. This happen if I update app on my phone. If I install it, or delete and then install all work fine.</p>

<p>I understood, that sqlite in my program save <em>R</em> Ids of drawables only once on install. When I add or delete drawables or strings, <em>R</em> changes ids numbers, but in my sqlite table saved old <em>R</em> ids.</p>

<p>I can try to write method, that will update all <em>R</em> ids in sqlite everytime when I will add or delete new strings and drawables, by increasing DB_VERSION each time.
Is there simpler solution?</p>

<p>This is one of my Adapters:</p>

<pre><code>public class SpinnerCursorAdapter extends CursorAdapter {

public SpinnerCursorAdapter(Context context, Cursor cursor) {
    super(context, cursor, 0);
}

@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
    View view = LayoutInflater.from(context).inflate(R.layout.spinner_item, parent, false);
    ViewHolder viewHolder = new ViewHolder(view);
    view.setTag(viewHolder);
    return view;
}

@Override
public void bindView(View view, Context context, Cursor cursor) {
    ViewHolder viewHolder = (ViewHolder) view.getTag();

    int flagIconId = Integer.valueOf(cursor.getString(5));
    viewHolder.flagIcon.setImageResource(flagIconId);

    String currencyName = cursor.getString(4);
    viewHolder.currencyName.setText(currencyName);

    viewHolder.currencyCharCode.setText(cursor.getString(1));
}

private static class ViewHolder {
    final ImageView flagIcon;
    final TextView currencyName;
    final TextView currencyCharCode;

    private ViewHolder(View view) {
        flagIcon = (ImageView) view.findViewById(R.id.spinner_flag_icon);
        currencyName = (TextView) view.findViewById(R.id.spinner_currency_name);
        currencyCharCode = (TextView) view.findViewById(R.id.spinner_currency_char_code);
    }
}
</code></pre>

<p>}</p>