Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MainActivity.java
- =====================
- package com.example.teacher.mytasks;
- import android.content.Intent;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.Toast;
- public class MainActivity extends AppCompatActivity implements View.OnClickListener{
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- }
- @Override
- public void onClick(View view) {
- switch (view.getId()){
- case R.id.btnLogin:
- //checkLogin();
- Intent intent = new Intent(this, Tasks.class);
- intent.putExtra("userName","Zeevik");
- startActivity(intent);
- break;
- case R.id.btnRegister:
- startActivity(new Intent(this,Register.class));
- break;
- default:
- Toast.makeText(this, "Error in button", Toast.LENGTH_SHORT).show();
- }
- }
- private void checkLogin() {
- }
- }
- activity_main.xml
- ======================
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_weight="1">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:src="@drawable/task"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_weight="1">
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/userLogin"
- android:hint="Enter user name..."
- android:layout_marginTop="20dp"/>
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:id="@+id/userPass"
- android:hint="Enter user pass..."
- android:inputType="textPassword"
- android:layout_marginTop="20dp"/>
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1"
- android:orientation="horizontal">
- <Button
- android:id="@+id/btnLogin"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_margin="20dp"
- android:layout_weight="1"
- android:background="#009fff"
- android:onClick="onClick"
- android:text="Login"
- android:textColor="#ffffff"
- android:textSize="22sp"
- />
- <Button
- android:id="@+id/btnRegister"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_margin="20dp"
- android:layout_weight="1"
- android:background="#009fff"
- android:onClick="onClick"
- android:text="Register"
- android:textColor="#ffffff"
- android:textSize="22sp" />
- </LinearLayout>
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical"
- android:layout_weight="1">
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="18dp"
- android:text="in memory of Tomer, which didn't bring chocolate to the class, shame you!!!"
- android:gravity="center"/>
- </LinearLayout>
- </LinearLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement