My app does show up in the emulator, but when I click on it the VS Emulator just shows a blank white screen for my app. enter image description here
Below is my code for my FirstLogin Activity
package com.example.android.fantappstic_app;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
public class FirstLogin extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_first_login);
Button login_button = (Button) findViewById(R.id.login_button);
final EditText user_field = (EditText)findViewById(R.id.user_field);
final EditText pass_field = (EditText)findViewById(R.id.pass_field);
Button signup_button = (Button) findViewById(R.id.signup_button);
login_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(user_field.getText().toString().equals("codergal") && pass_field.getText().toString().equals("12345"))
{
Intent GotoHomeScreen = new Intent(FirstLogin.this, HomeScreen.class);
FirstLogin.this.startActivity(GotoHomeScreen);
}
else
{
Toast.makeText(getApplicationContext(), "Wrong Credentials",Toast.LENGTH_SHORT).show();
}
}
});
signup_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent GotoSignUpBasic = new Intent(FirstLogin.this, SignUpBasicInfo.class);
FirstLogin.this.startActivity(GotoSignUpBasic);
}
});
}}
Below is my XML File for FirstLogin Activity:
`<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.android.fantappstic_app.HomeScreen">
<TextView
android:id="@+id/login_welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Welcome to App!"
android:textSize="36sp"
tools:layout_editor_absoluteY="47dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<EditText
android:id="@+id/user_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPersonName"
android:text="Username"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_editor_absoluteY="258dp" />
<EditText
android:id="@+id/pass_field"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textPassword"
android:text="Password"
app:layout_constraintHorizontal_bias="0.502"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
tools:layout_editor_absoluteY="325dp" />
<Button
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="74dp"
android:onClick="login"
android:text="Log In"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
<Button
android:id="@+id/signup_button"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="148dp"
android:text="Sign Up"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginBottom="16dp" />
</android.support.constraint.ConstraintLayout>
And lastly, here is my AndroidManifest.xml file. I added FirstLogin as a parent function of HomeScreen activity.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.fantappstic_app">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".HomeScreen"
android:parentActivityName=".FirstLogin">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SignUpBasicInfo"></activity>
</application>
</manifest>
So basically, a) I'm not getting any errors anywhere b) I have designed components such as buttons and TextViews but they aren't showing up in VS Emulator. Additionally, my VS Emulator is a 5.7" Marshmallow (6.0.0) XHDPI Phone API Level 23. I also tried 5" KitKat (4.4) XXHDPI Phone API Level 19 as a different device too.
Here's the correct code.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.fantappstic_app">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".FirstLogin"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".HomeScreen"
android:parentActivityName=".FirstLogin" />
<activity android:name=".SignUpBasicInfo"></activity>
</application>
</manifest>