main/java/com/sample/mchquiz/HighestScoreActivity.java
<reponame>xypher07/android-python-sql-exam<filename>main/java/com/sample/mchquiz/HighestScoreActivity.javapackage com.sample.mchquiz;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

public class HighestScoreActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_highest_score);

        TextView txtScore = (TextView) findViewById(R.id.textScore);

        // receive the score from last activity by Intent
        Intent intent = getIntent();
        int score = intent.getIntExtra("score", 0);
        // display current score
        txtScore.setText("Your score: " + score);

        // use Shared preferences to save the best score
        SharedPreferences mypref = getPreferences(MODE_PRIVATE);



    }

    public void onRepeatClick(View view) {
        Intent intent = new Intent(HighestScoreActivity.this, IPActivity.class);
        startActivity(intent);
    }
}

