please any help ? I just want to run an Android studio Application and the first Activity is an EditText and button when the user enter his/her age the application will run as his/her age ... and it's just run once ++ here is my code please help me:):):) And thanx in Advance. Sorry about my English,,,
package com.example.administrator.muslimsapp;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
SharedPreferences settings = this.getSharedPreferences("appInfo", 0);
boolean firstTime = settings.getBoolean("first_time", true);
if (firstTime) {
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("first_time", false);
editor.commit();
}
}
public void clickme(View view) {
EditText edt=(EditText)findViewById(R.id.edt1);
String ed=edt.getText().toString();
if(ed==""){
Intent i=new Intent(MainActivity.this,MainActivity.class);
startActivity(i);
}
if(Integer.parseInt(ed)<=13){
Intent i=new Intent(MainActivity.this,Main2Activity.class);
startActivity(i);
}
else if(Integer.parseInt(ed)>13){
Intent i2=new Intent(MainActivity.this,Main3Activity.class);
startActivity(i2);
}
}
}