8.5 C
New York
Friday, July 10, 2020
No menu items!
Home Android tutorials How to make android studio login page Sql (part 1)

How to make android studio login page Sql (part 1)

Android studio login page SQL in Urdu and Hindi for a beginner:

Android studio login page SQL Urdu and Hindi: Welcome to Rise Pakistani Urdu and Hindi tutorial. Today we will continue the first part of android studio login page SQL Urdu and Hindi. You can watch my video tutorial on my website RisePakistani or Youtube channel. If you like my video please like my video. If you have any issue please comment here thank you.

Internet permission:

Android manifest file

Add this code in your android studio AndroidManifest.xml   file.  This code allows you to get internet permission in your android app.

 

 

<uses-permission android:name="android.permission.INTERNET" />

Login view page or user interface:

Add this code in your Activity.xml file which used to show interface on the mobile screen.  Here user will insert username and password and inter login button.

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Login"/>
<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/username"
    />
<EditText
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/password"
    />
<Button
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/login"
    android:text="login"
    android:onClick="loginbtn"
    />

Php Connection to MySQL:

If we want to get data to form MySql database, we need to able to connect to the server.

By following this link https://www.w3schools.com/php/php_mysql_connect.asp  you can learn how to make a connection with the server.

Main Activity :

The main activity is an important part of your app. All action can be performed in this part. you can make different activity in your app. Activity is the part where all activities are performed according to a user click.

EditText username, pass;

//Dbconn db;

   @Override
   protected void onCreate(Bundle savedInstanceState){
       super.onCreate( savedInstanceState );
      // set activity_main.xml layout
       setContentView( R.layout.activity_main );
      //  get user name id
       username=findViewById( R.id.username );
       // get user password id
       pass = findViewById( R.id.password );

   }

This code will execute on click login button.

public void loginbtn(View view)
{
// get username in string
 String user_name= username.getText().toString(); 
// get user password in string
 String user_pass= pass.getText().toString();
// get type
 String type= "Login"; 
 Dbconn dbconn=new Dbconn(this);
 dbconn.execute( type,user_name,user_pass );
 //Toast.makeText( this, "hj gkhg h gk0", Toast.LENGTH_SHORT ).show();
 }

 

click here and watch more video. If you like my video, please subscribe to my website.

6 COMMENTS

- Advertisment -

Most Popular

Pakistan Stock Exchange Attacked by Mama Baloch| Khalil and Rafique Heroes

Mama Baloch Attacked Pakistan Stock Exchange: On Monday 29th of June Pakistan Stock Exchange been attacked violently by 4 men of BLA. In combat fight,...

Is Babar Azam Getting Married?| The Pakistani Star Captain The King

Is Babar Azam Getting Married? In a recent Instagram Interaction with Shoiab Malik Babar Revealed that "He still got one year left till he can...

Social Norms and Disgrace of Humanity| The Unethical Pakistan

Social Norms and Disgrace of Humanity We as a nation can't stand side by side to our people and that's in our genes, to be...

Saba Qamar in a new hot Avatar| The Paki Drama Doll on Youtube

Saba Qamar in a New Hot Look Fans are going crazy after her monologue on youtube. Saba Qamar has now decided to roll the virtual...