Hello i need to save score on application close and when will start up to show the last score is entered... i have not idea how do i start i have searched on google but nothing found which can help me, please show me some ways/codes of doing it.
Thanks ! :)

Recommended Answers

You said you've searched on google? I'm not even an android developer, and I got this after a minute of looking:

Jump to Post

@Hiroshe you should spend more then minute because you would find there are multiple options that are explained here http://developer.android.com/guide/topics/data/data-storage.html
@Stefan the simplest and easiest is

Jump to Post

All 5 Replies

Actualy the score is taken from mysql database and all i want to make is to read the score on application start up, im sorry i forgot to write this..

I have this code but it doesnt work application is crashing or not showing the results...

try {
            Connection conn = DriverManager.getConnection("jdbc:mysql://DATABASE", "USERNAME", "PASSWORD");
            Statement stmt = conn.createStatement();
            ResultSet rset = stmt.executeQuery("select * from BackgammonResults");
            while (rset.next()) {
                asd = rset.getInt("Stefan"); // local variable
                asd1 = rset.getInt("Bojan"); // local variable

        } catch (Exception e) {

I'm not a huge fan of connecting a user-end application to a remote database like that. I would suggest making a TCP server that does the database access for you.

What does the error look like?

Theres much error lines i cannot copy and paste it all that.. but the first line is: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver but i have the MySQL-Connector...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.