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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:30:17+00:00 2026-05-31T07:30:17+00:00

This is my code of a sample details gathering page,where once the customer enters

  • 0

This is my code of a sample details gathering page,where once the customer enters his details, it will be stored until another reinstall of this application, there is no error in the code and it executes correctly, but the customer is able to move to the next activity without filling out the form

and i tried a bit of condition checks but all those failed, need some help in code logic

    package asr.customer;

import java.io.File;
import java.util.Locale;

import android.app.Activity;
import android.os.Bundle;
import android.content.Intent;
import android.content.ContentValues;
import android.text.Editable;
import android.database.sqlite.SQLiteDatabase;
import android.view.*;
import android.widget.*;

public class ASRCustomerAppActivity extends Activity implements Button.OnClickListener{
/** Called when the activity is first created. */
    Button btn;
    ContentValues values= new ContentValues();
    SQLiteDatabase db;
    String first,last,state,city,g;
    int day,month,year;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btn=(Button)findViewById(R.id.save);
        btn.setOnClickListener(this);
        File dbtest =new File("/data/data/asr.customer/databases/customerdetail1.db");
        if(dbtest.exists())
        {
          // what to do if it does exist
            Intent intent=new Intent();
            intent.setClass(this,mapActivity.class);
            startActivity(intent);
            finish();
        }
        else
        {

           db=openOrCreateDatabase("customerdetail1.db",SQLiteDatabase.CREATE_IF_NECESSARY,null);

            db.setVersion(1);
            db.setLocale(Locale.getDefault());
            db.setLockingEnabled(true);
            final String table_create="CREATE TABLE customer("+"firstname TEXT,"+"lastname TEXT,"+"day INTEGER,"+"gender TEXT,"+"month INTEGER,"+"year INTEGER,"+"city TEXT,"+"state TEXT);";
            db.execSQL(table_create);
            EditText i2=(EditText)findViewById(R.id.first);
            first=i2.getText().toString();
            EditText i3=(EditText) findViewById(R.id.last1);
            last=i3.getText().toString();

            DatePicker d=(DatePicker) findViewById(R.id.date);
            day=d.getDayOfMonth();
            month= d.getMonth()+1;
            year=d.getYear();
            RadioGroup rg= (RadioGroup) findViewById(R.id.radiogroup);
            RadioButton r1= (RadioButton) findViewById(R.id.radioButton1);
            RadioButton r2= (RadioButton) findViewById(R.id.radioButton2);
            if(r1.isChecked()==true)
            {
            g=r1.getText().toString();
            }
            else
            {
            g= r2.getText().toString();
            }

            EditText i4=(EditText) findViewById(R.id.city);
            city=i4.getText().toString();
            EditText i5=(EditText) findViewById(R.id.state);
            state=i5.getText().toString();





            }
        }
    public void onClick(View v) {
        // what to do if it doesn't exist

        do{
            //  code
            Toast.makeText(ASRCustomerAppActivity.this, "Please Fill The Blank Spaces", Toast.LENGTH_LONG).show();

        }while((first.equalsIgnoreCase("") || last.equalsIgnoreCase("") || city.equalsIgnoreCase("") || state.equalsIgnoreCase("")));


            values.put("firstname",first);
            values.put("lastname",last);
            values.put("day",day);
            values.put("month",month);
            values.put("year",year);
            values.put("gender",g);
            values.put("city",city);
            values.put("state",state);

            db.insert("customer", null, values);

            Intent intent=new Intent();
            intent.setClass(this,mapActivity.class);
            startActivity(intent);
            finish();
        }



    }
  • 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-31T07:30:19+00:00Added an answer on May 31, 2026 at 7:30 am

    instead of this

    while((first.equalsIgnoreCase("") || last.equalsIgnoreCase("") || city.equalsIgnoreCase("") || state.equalsIgnoreCase("")));
    

    try this

    while((first.length==0|| last.length==0 || city.length==0|| state.length==0));
    

    and put this inside your onClick

     first=i2.getText().toString();
     last=i3.getText().toString();
    city=i4.getText().toString();
    state=i5.getText().toString();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For one or another reason this code sample gives 48 hours instead of 24,
I'm reading this code sample : And since I don't know C#, I decided
In this particular code sample I want to reference the second overloaded method (int
I am new to scheme. This is code sample from SICP course of MIT.
I'm trying to learn the Enterprise Library. I found this useful code sample to
In this sample code the URL of the app seems to be determined by
Given this sample code: #include <iostream> #include <stdexcept> class my_exception_t : std::exception { public:
This is a code sample taken from the Google Maps API developer's guide. I'm
I have this sample code: DirectoryEntry _entry = new DirectoryEntry( connectionString, this.userPrinicipalName, this.password, AuthenticationTypes.SecureSocketsLayer
I have this sample code for async operations (copied from the interwebs) public 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.