Created
January 7, 2017 05:34
-
-
Save louiswho/ae9b4f1a8e157c982514db799ed91a7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:id="@+id/activity_main" | |
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" | |
tools:context="please.help.myapplication.MainActivity"> | |
<EditText | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:inputType="textPersonName" | |
android:ems="10" | |
android:layout_below="@+id/textView" | |
android:layout_alignParentLeft="true" | |
android:layout_alignParentStart="true" | |
android:layout_marginLeft="11dp" | |
android:layout_marginStart="11dp" | |
android:layout_marginTop="40dp" | |
android:id="@+id/textUser" | |
android:hint="Username" /> | |
<EditText | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:inputType="textPassword" | |
android:ems="10" | |
android:layout_marginTop="16dp" | |
android:id="@+id/textPass" | |
android:hint="Password" | |
android:layout_below="@+id/textUser" | |
android:layout_alignLeft="@+id/textUser" | |
android:layout_alignStart="@+id/textUser" /> | |
<Button | |
android:text="Login" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" | |
android:layout_below="@+id/textPass" | |
android:layout_centerHorizontal="true" | |
android:layout_marginTop="53dp" | |
android:id="@+id/buttonLogin" | |
android:onClick="onLogin (MainActivity)" /> //THE PROBLEM IS HERE, If I change line to android:onClick="onLogin" it works fine | |
</RelativeLayout> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package please.help.myapplication; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.util.Log; | |
import android.view.View; | |
import android.widget.EditText; | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
} | |
public void onLogin(View v){ | |
EditText user = (EditText) findViewById(R.id.textUser); | |
EditText pass = (EditText) findViewById(R.id.textPass); | |
Log.i("Login Info", (user.getText().toString()) + ":" + (pass.getText().toString())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment