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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:28:25+00:00 2026-05-28T08:28:25+00:00

The code is for the registation table for finace app The user registers into

  • 0

The code is for the registation table for finace app
The user registers into the app and it is stored into the database
later it will used to login into app
my problem is here that the database is being created but the table is not getting created and the appication is closing if we click on the submit button
similarly with the reset button

actually i should enter the data into the table but

public class Register extends Activity  {
        String str1;
     @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.register);

button for going back to the login page

            Button bk=(Button)findViewById(R.id.back);

            bk.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    Intent intent1=new Intent(v.getContext(), PersonelFinaceAppActivity.class);
                    startActivityForResult(intent1, 0);

                }
            });

button for the reset button it resets all the fields

            Button rst=(Button)findViewById(R.id.reset);
            rst.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    EditText et=(EditText)findViewById(R.id.fn);
                    et.setText("");
                    et=(EditText)findViewById(R.id.ln);
                    et.setText("");
                    et=(EditText)findViewById(R.id.un);
                    et.setText("");
                    et=(EditText)findViewById(R.id.pass);
                    et.setText("");
                    et=(EditText)findViewById(R.id.monincome);
                    et.setText("");
                    TextView tv =(TextView)findViewById(R.id.textView1);
                    tv.setText("Firstname ");
                    tv =(TextView)findViewById(R.id.textView2);
                    tv.setText("Lastname");
                    tv =(TextView)findViewById(R.id.textView3);
                    tv.setText("Username");
                    tv =(TextView)findViewById(R.id.textView6);
                    tv.setText("Password");
                    tv =(TextView)findViewById(R.id.textView7);
                    tv.setText("Monthlyincome");
                }
            });

check button for checking the useralready exits in the database of not

            Button chk=(Button)findViewById(R.id.chk);
            chk.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        // TODO Auto-generated method stub
                        String User;
                        EditText Username = (EditText)findViewById(R.id.un);
                        User = Username.getEditableText().toString().trim();
                        SQLiteDatabase db1;
                        db1 = openOrCreateDatabase("Userdetails.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
                        db1.setVersion(3);
                        db1.setLocale(Locale.getDefault());
                        db1.setLockingEnabled(true);
                    try{Cursor c1=db1.rawQuery("select Username from details1 where Username='"+User+"'",null);
                                if(c1.moveToNext()){showDialog(1);}
                                else{showDialog(2);}
                            }
                        catch (Exception e) {
                            // TODO: handle exception
                            }
                        }
                });

the problem arises here the submit button
it has to perform all the action of the app

            Button sub=(Button)findViewById(R.id.submit);
            sub.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view)  {
                    // TODO Auto-generated method stub

                        String First;
                        String Last;
                        String User;
                        String Pass;
                        String monthincome;
                        @SuppressWarnings("unused")
                        long l;
                        EditText Firstname =(EditText)findViewById(R.id.fn);
                        EditText Lastname = (EditText)findViewById(R.id.ln);
                        EditText Username = (EditText)findViewById(R.id.un);
                        EditText Password = (EditText)findViewById(R.id.pass);
                        EditText moninc = (EditText)findViewById(R.id.monincome);
                        First = Firstname.getEditableText().toString().trim();
                        Last = Lastname.getEditableText().toString().trim();
                        Pass = Password.getEditableText().toString().trim();
                        User = Username.getEditableText().toString().trim();
                        monthincome = moninc.getEditableText().toString().trim();
                        if(Firstname.length()<1 || Lastname.length()<1 || Password.length()<1 || Username.length()<1 || moninc.length()<1)
                        {showDialog(3);}
                        else{SQLiteDatabase db1;
                                    db1 = openOrCreateDatabase("Userdetails.db", SQLiteDatabase.CREATE_IF_NECESSARY, null);
                                    db1.setVersion(3);
                                    db1.setLocale(Locale.getDefault());
                                    db1.setLockingEnabled(true);
                                    final String CREATE_TABLE_DETAILS ="CREATE TABLE details1 (" + "Username INTEGER PRIMARY KEY ," + "Firstname TEXT," + "Lastname TEXT," + "Password TEXT," + "Monthlyincome TEXT);"; 
                            db1.execSQL(CREATE_TABLE_DETAILS); 
                            try{Cursor c1=db1.rawQuery("select Username from details1 where Username='"+User+"'",null);
                                        if(c1.moveToNext())
                                        {showDialog(4);}
                                        else{
                                        ContentValues values1 = new ContentValues();
                                        values1.put("Firstname", First);
                                        values1.put("Lastname", Last);
                                        values1.put("Username", User);
                                        values1.put("Password", Pass);
                                        values1.put("Monthlyincome", monthincome);
                                        db1.insert("details1", null, values1);
                                        showDialog(5);
                                        }
                                        }
                                        catch(Exception e)
                                        {}
                                        finally
                                        {}
                        }
                    }
            });
     }

}  

need help in only the submit button plz help

  • 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-28T08:28:26+00:00Added an answer on May 28, 2026 at 8:28 am

    figured it out the table creation is changed and its done

    SQLiteDatabase db1;

    db1 = openOrCreateDatabase(“Userdetails.db”, SQLiteDatabase.CREATE_IF_NECESSARY, null);

    db1.setVersion(3);
    db1.setLocale(Locale.getDefault());

    db1.setLockingEnabled(true);

    final String CREATE_TABLE = “CREATE TABLE IF NOT EXISTS details1 (“+ “ID INTEGER primary key AUTOINCREMENT,”+ “Firstname TEXT,”+ “Lastname TEXT,”+ “Username TEXT,”+ “Password TEXT,” + “Monthlyincome TEXT);”;

    db1.execSQL(CREATE_TABLE);

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

Sidebar

Related Questions

After successful user registration my MySQL db table puts 0000-00-00 00:00:00 into lastlogin_date and
TL;DR I want to check my Coupon table when a new user registers to
code snippet: //byte[] myByteArray = byte array from database (database BLOB) myByteArray = (byte[])
i need to retrive some data from table registration of database to show.aspx page
My idea: I have a database of users, each user has an autoincremented id
I am making a registration table which will check if the cellphone number typed
I'm currently going over my user registration code. The part I'm focusing on right
I kept getting FormatException was unhandled by user Code Following is the Code: using
I am trying to add data to the User table (after registration). Immediately after
I want to show the table in my PHP page, my code is: $query

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.