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 7667427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:06:00+00:00 2026-05-31T15:06:00+00:00

I am launching a dialog box using this code: //show login dialog final Dialog

  • 0

I am launching a dialog box using this code:

        //show login dialog
        final Dialog loginDialog = new Dialog(this);

        loginDialog.setTitle(getString(R.string.Login));

        LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View dialogView = li.inflate(R.layout.logindialog, null);
        loginDialog.setContentView(dialogView);
        loginDialog.setCancelable(false);
        loginDialog.show();

        Button cmdLogin = (Button)findViewById(R.id.cmdLogin);
        Button cmdSignup= (Button)findViewById(R.id.cmdSignup);

        if(cmdLogin==null)Log.d("Null Check","cmdLogin");
        if(cmdSignup==null)Log.d("Null Check","cmdSignup");

The XML file for R.layout.logindialog is

<?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="match_parent"
    android:orientation="vertical" 

    >    
    <EditText
        android:id="@+id/txtEmail"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textEmailAddress" 
        android:hint="@string/EmailAddress"
        android:layout_marginTop="10dip"
        android:layout_marginBottom="10dip"
    />
    <EditText
        android:id="@+id/txtPassword"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:inputType="textPassword" 
        android:hint="@string/Password"    
        android:layout_marginTop="10dip"
        android:layout_marginBottom="10dip"

    />
    <Switch
        android:id="@+id/switchRemember"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/RememberMe"
        android:layout_marginTop="10dip"
        android:layout_marginBottom="10dip"
        android:layout_marginLeft="10dip"        
        android:layout_marginRight="10dip"
         />
    <LinearLayout
        android:id="@+id/ButtonBoxes"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        >

        <Button
            android:id="@+id/cmdSignup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/Signup" />

        <Button
            android:id="@+id/cmdLogin"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/Login" />
    </LinearLayout>
</LinearLayout>

Notice the two null checks on the Java code in first snippet, they are returning null. I cant findout a reason why 😐

  • 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-05-31T15:06:01+00:00Added an answer on May 31, 2026 at 3:06 pm

    Right now you’re searching in the activity layout and not in the dialog layout, your code to find the buttons id should be like this:

    Button cmdLogin = (Button)loginDialog.findViewById(R.id.cmdLogin);
    Button cmdSignup= (Button)loginDialog.findViewById(R.id.cmdSignup);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I'm launching my eclipse application, the workspace selection dialog box is not coming.
From my C# app I'm launching annother app, which before execution sometimes show dialog/popup
I am getting an 3 dialog box while launching eclipse. whats the problem with
Launching code on document ready is a pillar of jQuery. But sometimes, lengthy operations
We are launching a site that is media heavy and looking at using silverlight,
I'm using the jquery ui dialog for a modal popup dialog. It's working great
Issue1: I want to show an alert window or message box before the Main
The facebook dialog is not launching from alert view handler. But facebook dialog launches
when launching the following code in ADL, why does the square continue to rotate?
I'm using launching firefox from the command line in a script to get snapshots

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.