diff --git a/AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903131/Net1414080903131MainActivity.java b/AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903131/Net1414080903131MainActivity.java index 94e6ba2d..6478e4d1 100644 --- a/AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903131/Net1414080903131MainActivity.java +++ b/AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903131/Net1414080903131MainActivity.java @@ -1,7 +1,11 @@ package edu.hzuapps.androidlabs.homeworks.net1414080903131; +import android.content.Intent; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; +import android.view.View; import android.widget.Button; import android.widget.EditText; @@ -12,6 +16,7 @@ public class Net1414080903131MainActivity extends AppCompatActivity { Button btLogin; Button btRegister; + Button btJson; EditText etUsername; EditText etPassword; @@ -22,16 +27,30 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_net1414080903131_main); btLogin= (Button) findViewById(R.id.bt_login); btRegister= (Button) findViewById(R.id.bt_register); + btJson= (Button) findViewById(R.id.bt_json); etUsername= (EditText) findViewById(R.id.et_id); etPassword= (EditText) findViewById(R.id.et_password); String username=etUsername.getText().toString(); String password=etPassword.getText().toString(); + if (check(username,password)){ + startActivity(new Intent(Net1414080903131MainActivity.this,Net1414080903131MenuActivity.class)); + } + btJson.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + startActivity(new Intent(Net1414080903131MainActivity.this,Net1414080903131ShowJsonActivity.class)); + } + }); + } - + public boolean check(String name,String password){ + if (name.equals("linzihong")&&password.equals("123456")){ + return true; + }return false; } } diff --git a/AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903231/Net1414080903131ShowJsonActivity.java b/AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903131/Net1414080903131ShowJsonActivity.java similarity index 100% rename from AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903231/Net1414080903131ShowJsonActivity.java rename to AndroidLabs/app/src/main/java/edu/hzuapps/androidlabs/homeworks/net1414080903131/Net1414080903131ShowJsonActivity.java diff --git a/AndroidLabs/app/src/main/res/layout/activity_net1414080903131_main .xml b/AndroidLabs/app/src/main/res/layout/activity_net1414080903131_main.xml similarity index 84% rename from AndroidLabs/app/src/main/res/layout/activity_net1414080903131_main .xml rename to AndroidLabs/app/src/main/res/layout/activity_net1414080903131_main.xml index 5ebb5020..3d37f77d 100644 --- a/AndroidLabs/app/src/main/res/layout/activity_net1414080903131_main .xml +++ b/AndroidLabs/app/src/main/res/layout/activity_net1414080903131_main.xml @@ -9,7 +9,8 @@ android:src="@drawable/stu_info" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="60dp"/> + android:layout_marginBottom="10dp" + android:id="@+id/imageView" /> + +