should I use db or not


Last Updated:

  1. proskier

    proskier Active Member This Topic's Starter

    Joined:
    May 12, 2010
    Messages:
    30
    Likes Received:
    0
    So my app is very simple that I am building.

    My main activity loads and xml file that is a bunch of tablerows and in my java I manipulate each of the row's background color(xml attribute) via this method


    Code (Text):
    1.     public void colorRow(int id, int starCount){
    2.         if (starCount == 0){
    3.             TableRow row = (TableRow) findViewById(id);
    4.             row.setBackgroundColor(Color.WHITE);
    5.         }
    6.         else if (starCount == 1){
    7.             TableRow row = (TableRow) findViewById(id);
    8.             row.setBackgroundColor(Color.YELLOW);
    9.         }
    10.         else if (starCount == 2){
    11.             TableRow row = (TableRow) findViewById(id);
    12.             row.setBackgroundColor(Color.CYAN);
    13.         }
    14.         else {
    15.             TableRow row = (TableRow) findViewById(id);
    16.             row.setBackgroundColor(Color.RED);
    17.         }
    18.     }
    so prettymuch I want my rows to save when a user exits the app, so when they reopen it the color of the rows will be saved and show properly.

    I was wondering if this would be wise to do with a db, preferences, savedInstanceState, or something else I dont know about.

    Can someone please shed some light on how I should go about doing this? Thanks so much everyone.
     

    Advertisement
  2. amar77

    amar77 New Member

    Joined:
    Jul 27, 2010
    Messages:
    4
    Likes Received:
    0
    I think preferences is the best solution for this :)
     
  3. cp1

    cp1 Well-Known Member

    Joined:
    Apr 30, 2010
    Messages:
    375
    Likes Received:
    35
    It probably depends on how many rows you have.
     

Share This Page

Loading...