Back to project page CrossOutXtreme.
The source code is released under:
Copyright (c) 2014, Matthew Koontz All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...
If you think the Android project CrossOutXtreme listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.crossoutxtrem; // w w w.j a v a 2 s . c o m import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.widget.TextView; public class Statistics extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.statistics); SharedPreferences prefs = this.getSharedPreferences("TriangleOfCircles", Context.MODE_PRIVATE); int wins = prefs.getInt("wins", 0); int losses = prefs.getInt("losses", 0); int total = wins+losses; double percent; if (total==0) percent = 0; else percent = (wins*100.0)/(double)total; TextView tv1 = (TextView) findViewById(R.id.textView3); TextView tv2 = (TextView) findViewById(R.id.textView5); TextView tv3 = (TextView) findViewById(R.id.textView9); TextView tv4 = (TextView) findViewById(R.id.textView7); tv1.setText(wins+""); tv2.setText(losses+""); tv3.setText(total+""); tv4.setText(String.format("%5.2f", percent)+"%"); } }