Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:48:27+00:00 2026-06-11T07:48:27+00:00

I have two textViews in one xml ie. Customer login and Suppliers login…When i

  • 0

I have two textViews in one xml ie. Customer login and Suppliers login…When i am clicking on cuztomer login or suppliers login pop up should open on that I want to show my login form.
Help me out please.

Here is my login form:login_layout.xml

   <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:orientation="vertical" >

    <include layout="@layout/header_layout" />
        <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_margin="10dip"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/lbl_username"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="30dip"
            android:gravity="center"
            android:textColor="#000000"
            android:text="@string/username"
            />

        <EditText
            android:id="@+id/et_username"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dip"
            android:hint="@string/enter_username"
            android:inputType="textEmailAddress" />

        <TextView
            android:id="@+id/lbl_password"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dip"
            android:gravity="center"
             android:textColor="#000000"
            android:text="@string/password"
            />

        <EditText
            android:id="@+id/et_password"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dip"
            android:hint="@string/enter_password"
            android:inputType="textPassword"
            android:singleLine="true" />
         <TextView
            android:id="@+id/lbl_forgot"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="25dip"
            android:gravity="center"
            android:textColor="#000000"
            android:text="@string/forgot_password"
            android:textSize="18dp"
            />

        <Button
            android:id="@+id/loginButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="15dip"
            android:text="@string/login"
             />
    </LinearLayout>

</LinearLayout>

Here is LoginActivity.java:

package com.Login;

import android.os.AsyncTask;
import android.os.Bundle;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;


import org.json.JSONException;
import org.json.JSONObject;


public class LoginActivity extends Activity {

    private EditText etUsername, etPassword;
    private Button loginButton;
    private JSONParser jsonParser;
    private static String loginURL = "http://www.xyz.com?login.php";

    private Bundle bundle;
    private String success;
    /** The dialog. */
    private ProgressDialog dialog;



    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login_layout);

        TextView textv = (TextView) findViewById(R.id.lbl_forgot);
        textv.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub
                Intent intent = new Intent();
                intent.setClass(v.getContext(), ForgotPassActivity.class);
                startActivity(intent);

            }
        });
        intitDisplay();
        addListeners();

    }

    private void addListeners() {
        loginButton.setOnClickListener(new OnClickListener() {

            public void onClick(View v) {

                if (etUsername.getText().length() == 0)
                    etUsername.setError("please enter username");

                if (etPassword.getText().length() == 0)
                    etPassword.setError("please enter password");

                if ((etUsername.getText().length() > 0)
                        && (etPassword.getText().length() > 0)) {
                    jsonParser = new JSONParser();

                    if (jsonParser.isNetworkAvailable(LoginActivity.this)) {
                        new BackgroundTask().execute();
                    } else {
                        Toast.makeText(LoginActivity.this,
                                "Network not available", Toast.LENGTH_LONG)
                                .show();
                    }
                }

            }
        });

    }

    private void intitDisplay() {
        etUsername = (EditText) findViewById(R.id.et_username);
        etPassword = (EditText) findViewById(R.id.et_password);
        loginButton = (Button) findViewById(R.id.loginButton);
        bundle = new Bundle();
        dialog = new ProgressDialog(LoginActivity.this);

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.login_layout, menu);
        return true;
    }

    /** calling web service to get creditors list */
    /**
     * The Class BackgroundTask.
     */
    private class BackgroundTask extends AsyncTask<String, Void, String> {

        /** The resp. */
        String resp;

        /*
         * (non-Javadoc)
         * 
         * @see android.os.AsyncTask#onPreExecute()
         */
        protected void onPreExecute() {

            dialog.setMessage("Loading...");
            dialog.setCancelable(false);
            dialog.show();

        }

        /*
         * (non-Javadoc)
         * 
         * @see android.os.AsyncTask#doInBackground(Params[])
         */
        protected String doInBackground(final String... args) {

            Log.v("ENTERED USERNAME::", "" + etUsername.getText().toString());
            String newUrl = loginURL + "username="
                    + etUsername.getText().toString() + "&password="
                    + etPassword.getText().toString();
            JSONObject json = jsonParser.getJSONFromUrl(newUrl);

            try {
                success = json.getString("msg");
                Log.v("SUCCESS:: ", success);
                if (success.trim().toString().equalsIgnoreCase("SUCCESS")) {
                    String loggedUsername = json.getString("USER_NAME");
                    bundle.putString("loggedUser", loggedUsername);
                    Log.v("Logged User::", loggedUsername);

                }
            } catch (JSONException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

            return null;

        }

        /*
         * (non-Javadoc)
         * 
         * @see android.os.AsyncTask#onPostExecute(java.lang.Object)
         */
        protected void onPostExecute(String list) {
            dialog.dismiss();
            if (success.trim().toString().equalsIgnoreCase("SUCCESS")) {
                Toast.makeText(LoginActivity.this, "Login Succesfull..",
                        Toast.LENGTH_LONG).show();
                Intent intent = new Intent(LoginActivity.this,
                        HomeActivity.class).putExtras(bundle);
                startActivity(intent);
            } else {
                Toast.makeText(LoginActivity.this, "Login failed...",
                        Toast.LENGTH_LONG).show();
            }

        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:48:28+00:00Added an answer on June 11, 2026 at 7:48 am

    Use this

    Create a new xml file which has the textfields,edittexts,buttons i.e. your login form that you want to show in the popup.Now call the following method where you want to show the popup.

    private void callLoginDialog() 
         {
             myDialog = new Dialog(this);
             myDialog.setContentView(R.layout.yourxmlfileID);
             myDialog.setCancelable(false);
             Button login = (Button) myDialog.findViewById(R.id.yourloginbtnID);
    
              emailaddr = (EditText) myDialog.findViewById(R.id.youremailID);
              password = (EditText) myDialog.findViewById(R.id.yourpasswordID);
              myDialog.show();
    
             login.setOnClickListener(new OnClickListener()
             {
    
                @Override
                public void onClick(View v)
                {
                        //your login calculation goes here
                }
            });
    
    
         }
    

    Let me know if it helps you….

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have got relative layout, in that i have placed two textviews, one image
I have two relative layouts that are currently displayed one below the other. I
I have a custom listview row whose XML has one ImageView and three TextViews
I have two fragments inside my activity. That works fine. Now inside one of
In My application XML layout, I have one Relativelayout, In which there are two
I have a layout containing two textViews and one ImageView. the first text is
I have: One MyListActivity class extends ListActivity setContentView(R.layout.mylist) ; Two xml files: mylist.xml and
I have a problem with two Textviews on the same height in a RelativeLayout
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two classes (MVC view model) which inherits from one abstract base class.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.