I want to store a score and name value and need to retrieve and edit it whenever a user gets higher score. How can I do that? Can somebody help me here using my code please?
MainActivity.java
package com.thesis.boggleit;
import java.util.ArrayList;
import java.util.concurrent.TimeUnit;
import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
public class MainActivity extends Activity {
//VARIABLES HERE
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
dbHelper =new DBAdapter(this);
search = (EditText) findViewById(R.id.textHere);
OnClickListener myCommoClickListner = new OnClickListener(){
@Override
public void onClick(View arg0) {
Log.i(TAG,"arg0.getId()="+arg0.getId());
if (arg0.getId()==R.drawable.a){
Log.i(TAG,"arg0.getId()="+arg0.getId());
generatedString=generatedString+("a");
text.setText(generatedString);
((ImageButton) arg0).setImageResource(R.drawable.changea);
if (!timeHasStarted) {
countDownTimer.start();
timeHasStarted = true;
}
}
};
image1.setOnClickListener(myCommoClickListner);
}
//TIMER HERE
private int optionTxtView = 0 ;
private int addClick = 0 ;
private void calculate(){
x = Integer.parseInt(tv3.getText().toString().replaceAll("\\s",""));
y = Integer.parseInt(tv2.getText().toString().replaceAll("\\s",""));
z = x + y;
score.setText(Integer.toString(z));
}
String s1= search.getText().toString();
String s2= dbHelper.getData(s1);
........
}
TIA