I want my application(android) to go to another activity on the first launch, so people immediately change their settings. After I update my application I want to show a changelog. I know you can make this happen with shared preferences and I made something like this:
package me.wouter.schoolwork;
import android.app.Activity;
import android.app.AlertDialog;
import android.os.Bundle;
public class Updater extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.update);
checkFirstLaunch();
}
public void checkFirstLaunch(){
boolean firstrun = getSharedPreferences("PREFERENCE", MODE_PRIVATE).getBoolean("firstrun", true);
if (firstrun){
new AlertDialog.Builder(this).setTitle("Welcome").setMessage("Welcome on ").setNeutralButton("OK", null).show();
getSharedPreferences("PREFERENCE", MODE_PRIVATE)
.edit()
.putBoolean("firstrun", false)
.commit();
}
}
}
I'm not sure if this works, and this doesn't work for updating. Can anyone help me?
Thanks in advance :)