I am working on app that will display the score in a textview and will then get that score in another activity. Am doing this using the following code:
        //in the first activity
        int score= 0;
        score= score + 5;
        txtscore.setText("Score: " + score);
        Intent intent = new Intent(context, AnotherActivity.class);
        intent.putExtra("Score",score+ " ");
        context.startActivity(intent);
         //in second activity (AnotherActivity.class)
          Bundle bundle = getIntent().getExtras();
        if (bundle != null){
        int score= bundle.getInt("0");
        txtscore.setText("0" + score);
    }
Now I need to use the score that has been save in txtscore in a static method in the second class itself, whereby 5 points need to be added making a total of 10.
I have a static method:
    private static void rotate{
         //some tasks being done
        if (isSolved()){
        int new =0;
        // need to get value from another activity here and save to x
        new = x + 10;
        txtscore.setText("Score: " + new );
    }
}
Any help?
 
     
    