HighScore.java
package com.vikesh.gamesudoku;
import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.TextView;
public class HighScore extends Activity {
SQLiteDatabase db=null;
String TABLE ="highscore";
String NAME[]= new String[100];
String LEVEL[] = new String[100];
String TIME[]=new String[100];
TextView t[] = new TextView[3];
TextView t2[] = new TextView[3];
TextView t3[] = new TextView[3];
int i=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db=openOrCreateDatabase("sudoku",MODE_PRIVATE, null);
Cursor c=db.rawQuery("select * from "+TABLE,null);
c.moveToFirst();
do
{
NAME[i]=c.getString(0);
LEVEL[i]=c.getString(1);
TIME[i]=c.getString(2);
i++;
}while(c.moveToNext());
setContentView(R.layout.high_score);
t[0] =(TextView)findViewById(R.id.TextView04);
t2[0] =(TextView)findViewById(R.id.TextView041);
t3[0] =(TextView)findViewById(R.id.TextView042);
t[1] =(TextView)findViewById(R.id.TextView043);
t2[1] =(TextView)findViewById(R.id.TextView044);
t3[1] =(TextView)findViewById(R.id.TextView045);
t[2]=(TextView)findViewById(R.id.TextView046);
t2[2]=(TextView)findViewById(R.id.TextView047);
t3[2]=(TextView)findViewById(R.id.TextView048);
for(int i=0;i<3;i++)
{
t[i].setText(NAME[i]);
t2[i].setText(LEVEL[i]);
t3[i].setText(TIME[i]);
}
}
}
package com.vikesh.gamesudoku;
import android.app.Activity;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.widget.TextView;
public class HighScore extends Activity {
SQLiteDatabase db=null;
String TABLE ="highscore";
String NAME[]= new String[100];
String LEVEL[] = new String[100];
String TIME[]=new String[100];
TextView t[] = new TextView[3];
TextView t2[] = new TextView[3];
TextView t3[] = new TextView[3];
int i=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
db=openOrCreateDatabase("sudoku",MODE_PRIVATE, null);
Cursor c=db.rawQuery("select * from "+TABLE,null);
c.moveToFirst();
do
{
NAME[i]=c.getString(0);
LEVEL[i]=c.getString(1);
TIME[i]=c.getString(2);
i++;
}while(c.moveToNext());
setContentView(R.layout.high_score);
t[0] =(TextView)findViewById(R.id.TextView04);
t2[0] =(TextView)findViewById(R.id.TextView041);
t3[0] =(TextView)findViewById(R.id.TextView042);
t[1] =(TextView)findViewById(R.id.TextView043);
t2[1] =(TextView)findViewById(R.id.TextView044);
t3[1] =(TextView)findViewById(R.id.TextView045);
t[2]=(TextView)findViewById(R.id.TextView046);
t2[2]=(TextView)findViewById(R.id.TextView047);
t3[2]=(TextView)findViewById(R.id.TextView048);
for(int i=0;i<3;i++)
{
t[i].setText(NAME[i]);
t2[i].setText(LEVEL[i]);
t3[i].setText(TIME[i]);
}
}
}
No comments:
Post a Comment