I am trying to create a screen for my app that allows the user to create a user name, and then launch the application. I already have a screen that has everything I want the user to do, but I now would like to add a login screen that the user must utilize before getting to the activity screen. I have the login screen designed, and a separate class ready to go. Doe's anyone know how to go about it so that MainActivity loads the login first? I assume that I would then need to set some sort of Boolean flag that allows Main to load the rest of the app?
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
setContentView(R.layout.activity_main);
Size = (SeekBar)findViewById(R.id.size);
Speed =(SeekBar)findViewById(R.id.speed);
Agility=(SeekBar)findViewById(R.id.agility);
Vision =(SeekBar)findViewById(R.id.vision);
text = (TextView) findViewById(R.id.text);
Size.setOnSeekBarChangeListener(this);
Speed.setOnSeekBarChangeListener(this);
Agility.setOnSeekBarChangeListener(this);
Vision.setOnSeekBarChangeListener(this);
}
I have a set content view for my login.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin">
<Button
android:text="Begin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/begin"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="124dp" />
<EditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:text="Name"
android:ems="10"
android:layout_above="@+id/begin"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="88dp"
android:layout_marginEnd="88dp"
android:layout_marginBottom="149dp"
android:id="@+id/editText2" />
</RelativeLayout>
I have my layout. I also have the class, which is empty for right now.
Am I going to have to do something inside my AndroidManifest?