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

  • Home
  • SEARCH
  • 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 8061085
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:12:45+00:00 2026-06-05T10:12:45+00:00

I am developing an android application.I am new to android.The Onclick method is not

  • 0

I am developing an android application.I am new to android.The Onclick method is not being fired.I have been trying to figure it out for hours. I have checked the button ID and the code several times. I have posted my code below. Please help.

package com.android.disasterAlertApp;

import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
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;

public class Registration extends Activity{
Button sqlRegister;
EditText  sqlFirstName,sqlLastName,sqlEmail,sqlMobileNumber,sqlCurrentLocation,sqlUsername,sqlPassword;

    @Override
    protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    setContentView(R.layout.registration);
    sqlFirstName = (EditText) findViewById(R.id.etFname);
    sqlLastName = (EditText) findViewById(R.id.etLname);

    sqlRegister = (Button) findViewById(R.id.bRegister);
    sqlRegister.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            Toast.makeText(Registration.this, "fire", Toast.LENGTH_LONG).show();
            }
        });
    }
}    

————————XML File——————————–

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="536dp"
android:orientation="vertical" >

<TextView
    android:id="@+id/textView1"
    android:layout_centerInParent="true"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Register"
    android:layout_gravity="center"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textSize="20dp" />

<TextView
    android:id="@+id/textView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="First Name"
    android:textSize="15dp"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/etFname"
    android:layout_width="200dp"
    android:layout_height="45dp"
    android:ems="10"

    android:inputType="textPersonName" />

<TextView
    android:id="@+id/textView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Last Name"
    android:textSize="15dp"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/etLname"
    android:layout_width="200dp"
    android:layout_height="45dp"
    android:ems="10"
    android:inputType="textPersonName" >
</EditText>

<TextView
    android:id="@+id/textView4"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Email"
    android:textSize="15dp"
    android:textAppearance="?android:attr/textAppearanceMedium" />

<EditText
    android:id="@+id/etEmail"
    android:layout_width="200dp"
    android:layout_height="45dp"
    android:ems="10"
    android:inputType="textEmailAddress" />


/////This is the Register Button/////
<Button
    android:id="@+id/bRegister"
    style="?android:attr/buttonStyleSmall"
    android:layout_width="92dp"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:text="Register"
    android:textSize="15dp" />

 </LinearLayout>

 </ScrollView>
  • 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-05T10:12:47+00:00Added an answer on June 5, 2026 at 10:12 am

    I used the above code at may in a test project and it is working fine ….please see the image attached

    enter image description here

    Please let us know if there is any thing more in code which is not mentioned above.

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

Sidebar

Related Questions

I have been developing Android application where I use this code: Date d=new Date(new
I have been developing Android application for Android 3.x and now I want to
I have been developing Android application, and I have one question - ListView uses
I'm developing an Android application and I have a problem running a new thread
i am new bie in android, I am developing an application in Android, and
I am developing android application in which i have to open option menu from
We've been developing an Android application which includes Google Adsense. However there seems to
I have been developing an Android app and testing with a 1.5 AVD and
I am new to java development, I am from C# .net, developing android application.
I start developing a new Android application from scratch these days. The company I

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.