mercredi 25 février 2015

Using a seek bar using time in minutes and seconds and having a point system





  1. I have a seek bar in minutes and seconds, 1-18 minutes is 100 points, when 18 minutes hits, every ten seconds will decrease the points by 1 . ex: 18:09 = 99 points and so forth. My logic just is not working .. please help!


    case R.id.runBar: try{



    int max = 1980;
    // int min2 = 1080;

    int sec = Progress;


    int min = sec/60;
    sec = sec%60;


    time.setText(min + "min" + sec + "sec");

    runTime.setMax(max);
    if(sec > 1) {
    if (min <= 18) {

    runScore = runTime.getProgress();
    runScore = runScore/ max + 100;

    }


    if(min >= 18) {

    //runScore =(runTime.getProgress()/3600 + 100 *sec/100 -1);
    int lol = min%10;
    runScore = runScore/max + 100 -(lol);




    }
    }
    update();

    }
    catch(NumberFormatException e){

    }

    break;


    }


    }


    private void update(){ int total = runScore;



    answer.setText(String.format("%d",total));


    }






Aucun commentaire:

Enregistrer un commentaire