Darko Drogriski Darko Drogriski - 5 months ago 6x
Java Question

Android app save data

I recently started making android apps. The app I'm working on right now is a clicker game. I need the app to save the players money. Is there any way that i can do that without using mySQL?
Here's my MainActivity code.

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
int balance;
protected void onCreate(Bundle savedInstanceState) {
//Hide notification bar
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//Click counter
final TextView text = (TextView) findViewById(R.id.balance_text);
assert text != null;
final ImageButton button = (ImageButton) findViewById(R.id.click_button);
assert button != null;
button.setOnClickListener(new View.OnClickListener(){

public void onClick(View v){
text.setText("" + balance);


There's a great article called Storage Options, take a look and pick an approach that fits your use case best. Probably SharedPreferences will be the most appropriate solution.