Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /////////////////////////// Main_Activity////////////////////////////////
- public class MainActivity extends ActionBarActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- setPointer();
- Intent intent = getIntent();
- }
- //set pointers
- EditText txtUser;
- EditText txtPass;
- private void setPointer()
- {
- txtUser=(EditText)findViewById(R.id.user);
- txtPass=(EditText)findViewById(R.id.password);
- }
- public void btnLogin(View v)
- {
- String chkUser=txtUser.getText().toString();
- String chkPass=txtPass.getText().toString();
- if (chkUser.toLowerCase().equals("eylon") && chkPass.equals("123456"))
- {
- Toast.makeText(this, "hello user!", Toast.LENGTH_LONG).show();
- Intent intent = new Intent(MainActivity.this, Main2Activity.class);
- MainActivity.this.startActivity(intent);
- }
- else
- Toast.makeText(this, "Bad User or password", Toast.LENGTH_LONG).show();
- }
- }
- //////////////////////////////Main2_Activity////////////////////////////////////
- package com.example.eylonyizhack.login;
- import android.os.Bundle;
- import android.support.v7.app.ActionBarActivity;
- public class Main2Activity extends ActionBarActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main2);
- getSupportActionBar().setDisplayHomeAsUpEnabled(true);
- }
- }
- //////////////////////////////Activity_main - XML 1 //////////////////////////////////
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- xmlns:android="http://schemas.android.com/apk/res/android" >
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_weight="1">
- <ImageView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:src="@drawable/hucker"/>
- </LinearLayout>
- <RelativeLayout
- android:orientation="vertical"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_weight="1">
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="@string/username"
- android:textSize="25sp"
- android:layout_gravity="center_vertical"
- android:inputType="text"
- android:id="@+id/user"
- android:gravity="center"
- />
- <EditText
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="@string/password"
- android:textSize="25sp"
- android:layout_gravity="center_vertical"
- android:inputType="textPassword"
- android:id="@+id/password"
- android:gravity="center"
- android:layout_below="@+id/user"/>
- </RelativeLayout>
- <LinearLayout
- android:orientation="vertical"
- android:layout_height="match_parent"
- android:layout_width="match_parent"
- android:layout_weight="1">
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:text="@string/Login"
- android:textSize="35sp"
- android:id="@+id/logInButton"
- android:onClick="btnLogin"/>
- </LinearLayout>
- </LinearLayout>
- ////////////////////////////////////////////Activity_main XML 2 //////////////////////////////////
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical">
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- 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:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- android:text="קטלוג הקורסים"
- android:id="@+id/btnKursim"
- android:background="#22748F"
- android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
- android:textColor="#FFFFFF"/>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- android:text=" חוות דעת"
- android:id="@+id/btnHavotDaat"
- android:layout_below="@+id/btnKursim"
- android:background="#22748F"
- android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
- android:textColor="#FFFFFF"/>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- android:text="סניפים"
- android:id="@+id/btnSnifim"
- android:layout_below="@+id/btnHavotDaat"
- android:background="#22748F"
- android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
- android:textColor="#FFFFFF"/>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- android:text="צור קשר"
- android:id="@+id/btnTzruKesher"
- android:layout_below="@+id/btnSnifim"
- android:background="#22748F"
- android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
- android:textColor="#FFFFFF"/>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- android:text="מבצעים והנחות"
- android:id="@+id/btnMevtzaim"
- android:layout_below="@+id/btnTzruKesher"
- android:background="#22748F"
- android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
- android:textColor="#FFFFFF"/>
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:textSize="25sp"
- android:text="קבע פגישת יעוץ"
- android:id="@+id/btnKvaPgisha"
- android:layout_below="@+id/btnMevtzaim"
- android:background="#22748F"
- android:layout_margin="@dimen/abc_action_bar_subtitle_bottom_margin"
- android:textColor="#FFFFFF"/>
- </LinearLayout>
- <LinearLayout
- android:orientation="vertical"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- >
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:src="@drawable/back"
- />
- </LinearLayout>
- </LinearLayout>
Add Comment
Please, Sign In to add comment