Wednesday, 28 February 2018

submit a sign up button alldata pass to next text view activity

submit a sign up button
all typed data pass to next 
text view activity ,
data pass through last activity   


sign_up  activity preview :-




make new activity pass following step -  

right clik on app bar in project structure .> new>activity>empty activity> name file text_view  



now we have

1) activity_sign_up.xml
2)sign_up.java
3)activity_text_view.xml
4)text_view.java




code :-

1) activity_sign_up.xml
 
     in that activity we are use  
   </LinearLayout>
    </ScrollView>
as shown preview on top


activity_sign_up.xml

<?xml version="1.0" encoding="utf-8"?>
<android.widget.RelativeLayout 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.store.n01.Sign_up">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:scrollbars="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">


            <EditText
                android:id="@+id/edit_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:ems="10"
                android:inputType="textPersonName"
                android:hint="Name" />

            <EditText
                android:id="@+id/edt_mobileno"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/edit_name"
                android:layout_alignRight="@+id/edit_name"
                android:layout_below="@+id/editText4"
                android:ems="10"
                android:inputType="textPersonName"
                android:hint="@string/mobile_no" />

            <EditText
                android:id="@+id/edt_passwardsu"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/editText5"
                android:layout_alignRight="@+id/editText5"
                android:layout_below="@+id/editText5"
                android:ems="10"
                android:hint="@string/passward"
                android:inputType="textPersonName" />

            <EditText
                android:id="@+id/edt_mothername"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/editText7"
                android:layout_alignRight="@+id/editText7"
                android:layout_below="@+id/editText7"
                android:ems="10"
                android:hint="@string/mother_name"
                android:inputType="textPersonName" />

            <CheckBox
                android:id="@+id/checkBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/term_and_condition" />

            <Button
                android:id="@+id/btn_signup"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:background="@drawable/btn_all"
                android:text="@string/sign_up"
                android:textAlignment="center"
                android:textSize="19sp"
                android:padding="10dp"
                android:gravity="center"/>


        </LinearLayout>
    </ScrollView>
</android.widget.RelativeLayout>


2)sign_up.java


package com.example.store.n01;

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 Sign_up extends AppCompatActivity {
    EditText edit_name ,edt_mobileno ,edt_passwardsu ,edt_mothername;
    Button btn_signup ;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sign_up);
        edit_name = (EditText)findViewById(R.id.edit_name);
        edt_mobileno = (EditText)findViewById(R.id.edt_mobileno);
        edt_passwardsu=(EditText)findViewById(R.id.edt_passwardsu);
        edt_mothername= (EditText)findViewById(R.id.edt_mothername);

        btn_signup =(Button)findViewById(R.id.btn_signup);

        btn_signup.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String s1 = edit_name.getText().toString();
                String s2 =edt_mobileno.getText().toString();
                String s3 =edt_passwardsu.getText().toString();
                String s4 =edt_mothername.getText().toString();

                Intent i = new Intent(getApplicationContext(),text_view.class);
                i.putExtra("name",edit_name.getText().toString());
                i.putExtra("mobileno",edt_mobileno.getText().toString());
                i.putExtra("mothername",edt_mothername.getText().toString());
                i.putExtra("passwardsu",edt_passwardsu.getText().toString());

                startActivity(i);

               // Toast.makeText(Sign_up.this, s1 +"\n"+"\n"+s2 +"\n"+ s3+"\n"+s4, Toast.LENGTH_SHORT).show();

            }
        });

    }

}




3)activity_text_view.xml

activity preview :-

activity_text_view.xml

<?xml version="1.0" encoding="utf-8"?>
<android.widget.LinearLayout 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"
    android:orientation="vertical"
     >


    <TextView
        android:id="@+id/name_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/textview" />

    <TextView
        android:id="@+id/mobileno_tv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/textview" />

    <TextView
        android:id="@+id/passward_tv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/textview" />

    <TextView
        android:id="@+id/mothername_tv"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:text="@string/textview" />
</android.widget.LinearLayout>


4)text_view.java

package com.example.store.n01;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class text_view extends AppCompatActivity {

    TextView name_tv,mobileno_tv,passward_tv,mothername_tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_text_view);

        name_tv = (TextView)findViewById(R.id.name_tv);
        mobileno_tv = (TextView)findViewById(R.id.mobileno_tv);
        passward_tv= (TextView)findViewById(R.id.passward_tv);
        mothername_tv= (TextView)findViewById(R.id.mothername_tv);

        name_tv.setText(getIntent().getStringExtra("name"));
        mobileno_tv.setText(getIntent().getStringExtra("mobileno"));
        passward_tv.setText(getIntent().getStringExtra("mothername"));
        mothername_tv.setText(getIntent().getStringExtra("passwardsu"));

    }
}


it was pass a data 1st activity to other activity run


sign up activity with scroll view XMLfile




we introduce sign_up layout xml file for


xml file sign_up


<?xml version="1.0"
 encoding="utf-8"?>
<android.widget.RelativeLayout 
    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.store.n01.Sign_up">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:fillViewport="true"
        android:scrollbars="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">


            <EditText
                android:id="@+id/edit_name"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:ems="10"
                android:inputType="textPersonName"
                android:hint="Name" />

            <EditText
                android:id="@+id/edt_mobileno"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/edit_name"
                android:layout_alignRight="@+id/edit_name"
                android:layout_below="@+id/editText4"
                android:ems="10"
                android:inputType="textPersonName"
                android:hint="@string/mobile_no" />

            <EditText
                android:id="@+id/edt_passwardsu"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/editText5"
                android:layout_alignRight="@+id/editText5"
                android:layout_below="@+id/editText5"
                android:ems="10"
                android:hint="@string/passward"
                android:inputType="textPersonName" />

            <EditText
                android:id="@+id/edt_mothername"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_alignEnd="@+id/editText7"
                android:layout_alignRight="@+id/editText7"
                android:layout_below="@+id/editText7"
                android:ems="10"
                android:hint="@string/mother_name"
                android:inputType="textPersonName" />

            <CheckBox
                android:id="@+id/checkBox"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="@string/term_and_condition" />

            <Button
                android:id="@+id/btn_signup"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_centerVertical="true"
                android:background="@drawable/btn_all"
                android:text="@string/sign_up"
                android:textAlignment="center"
                android:textSize="19sp"
                android:padding="10dp"
                android:gravity="center"/>


        </LinearLayout>
    </ScrollView>
</android.widget.RelativeLayout>




PREVIEW OF XML FILE:-



login activity in xml file and java file for android

log in activity 



XML FILE ;




<?xml version="1.0" encoding="utf-8"?>
<android.widget.RelativeLayout 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"
    android:gravity="center"
    tools:context="com.example.store.n01.login_Activity">

    <EditText
        android:id="@+id/edt_email"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:background="@drawable/text_box"
        android:hint="@string/email_or_username"
        android:inputType="textEmailAddress"
        android:padding="10dp"
        android:gravity="center"
        />

    <EditText
        android:id="@+id/edt_passward"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/edt_email"
        android:layout_alignStart="@+id/edt_email"
        android:layout_below="@+id/edt_email"
        android:layout_marginTop="25dp"
        android:background="@drawable/text_box"
        android:hint="@string/passward"
        android:inputType="textPassword"
        android:textAlignment="center"
        android:padding="10dp"/>

    <Button
        android:id="@+id/btn_login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/edt_passward"
        android:layout_alignStart="@+id/edt_passward"
        android:layout_below="@+id/edt_passward"
        android:layout_marginTop="43dp"
        android:background="@drawable/btn_all"
        android:textSize="18sp"
        android:text="@string/bt_login"
        android:gravity="center"
        android:padding="10dp"/>

    <TextView
        android:id="@+id/textView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/btn_login"
        android:layout_alignRight="@+id/btn_login"
        android:layout_below="@+id/btn_login"
        android:layout_marginEnd="21dp"
        android:layout_marginRight="21dp"
        android:layout_marginTop="16dp"
        android:text="@string/forget_passward" />
</android.widget.RelativeLayout>









PREVIEW OF XML FILE




java FILE :-

(in that file include all error massage for email
check out , password length ,intent press login button to sign_up activiety
toast make ,also)

package com.example.store.n01;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Patterns;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class login_Activity extends AppCompatActivity {

    EditText edt_email,edt_passward;
    Button btn_login;


    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login_);

        edt_email = (EditText)findViewById(R.id.edt_email);
        edt_passward= (EditText)findViewById(R.id.edt_passward);
        btn_login=(Button)findViewById(R.id.btn_login);

        btn_login.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {

                if(checkEmail(edt_email,"Enter Valid Email") && checkpassward(edt_passward,"Enter 6 cherecter passward")) {

                    Intent i = new Intent(getApplicationContext(),Sign_up.class);
                    startActivity(i);


                   // String s1 = edt_email.getText().toString();                    //String s2 = edt_passward.getText().toString();
                    //oast.makeText(login_Activity.this, s1, Toast.LENGTH_SHORT).show();
                   // Toast.makeText(login_Activity.this, s2, Toast.LENGTH_SHORT).show();                }

               
            }
        });

    }

    public boolean checkEmail(EditText edt,String msg)
    {

        if(edt.getText().toString() != null && edt.getText().toString() != ""                && edt.getText().toString().length() > 0 && Patterns.EMAIL_ADDRESS.matcher(edt.getText().toString()).matches())
        {
            return true;
        }
        else{
            edt.setError(msg);
            return false;
        }
    }
    public boolean checkpassward(EditText edt,String msg)
    {

        if(edt.getText().toString() != null && edt.getText().toString() != ""                && edt.getText().toString().length() >= 6 )
        {
            return true;
        }
        else{
            edt.setError(msg);
            return false;
        }
    }
}

Tuesday, 27 February 2018

Button AND TEXT BOX for android drawable xml file

hello today

we introduce button layout xml file for colours and properties


xml file btm_all


<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners
        android:radius="17dp"        />
    <gradient
        android:angle="45"
        android:centerX="40%"
        android:centerColor="#f5e28c"
        android:startColor="#f9aaaa"
        android:endColor="#fc5454"
        android:type="linear"
        />
    <padding
        android:left="0dp"
        android:top="0dp"
        android:right="0dp"
        android:bottom="15dp"
        />
    <size

        android:height="60dp"
        android:width="270dp"
        />
    <stroke
        android:width="3dp"
        android:color="#f7f4f4"
        />
</shape>




file location 

app>res>drawable

file name - btn_all







preview :-




for 


 apply button for that background 


         android:background="@drawable/btn_all"


add that property in Button code


TEXT BOX DRAWABLE xml file :


<?xml version="1.0"
 encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners
        android:radius="17dp"
        />
    <gradient
        android:angle="45"
        android:centerX="40%"
        android:centerColor="#fff9dd"
        android:startColor="#fff1f1"
        android:endColor="#ffdddd"
        android:type="linear"
        />
    <padding
        android:left="0dp"
        android:top="0dp"
        android:right="0dp"
        android:bottom="15dp"
        />
    <size
        android:height="30dp"
        android:width="270dp"
        />
    <stroke
        android:width="3dp"
        android:color="#4b4b4b"
        />

</shape>

file location 
app>res>drawable
file name - text_box.xml





preview :-




apply text box for that background 


         android:background="@drawable/text_box"


add that property in text box code

B Remi Calculator

Loan Calculator Loan Calculator Loan Amount PF Cross Sell (LI % GI) No Yes EMI CARD No Ye...