mercredi 27 mai 2015

Sqlite is not updated in Samsung Galaxy S II (api 15 )

I have a List-view (worldpopulationlist is in Base-adapter) When a button is clicked in the mylist, the background of Button changed. in my Blue-stack (is API 19) and my android Phone (api 17) List-view and Sqlite updated correctly. but in Samsung Galaxy S II, Sqlite not updated.

Is the problem related to API or not?

    switch (worldpopulationlist.get(position).getfavorite()) {
                case 0:
                    worldpopulationlist.get(position).setfavorite(1);
                    mCursor2= db2.rawQuery("UPDATE khotbe SET favorites = 1 WHERE my_id ="+rr+"  ;",null);
                    mCursor2.moveToFirst();
                    holder.btn.setBackgroundResource(R.drawable.star);
                    Toast.makeText(mContext, "به لیست علاقه مندی ها اضافه شد", Toast.LENGTH_SHORT).show();

                    mCursor.requery();
                    adapter.notifyDataSetChanged();

                    break;
                    case 1:
                        mCursor2= db2.rawQuery("UPDATE khotbe SET favorites = 0 WHERE my_id ="+rr+"  ;",null);
                        mCursor2.moveToFirst();
                        holder.btn.setBackgroundResource(R.drawable.star_no);
                        Toast.makeText(mContext, "از لیست علاقه مندی های حذف گردید", Toast.LENGTH_SHORT).show();
                        worldpopulationlist.get(position).setfavorite(0);
                        mCursor.requery();
                        adapter.notifyDataSetChanged();
                        break;

Aucun commentaire:

Enregistrer un commentaire