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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:31:32+00:00 2026-05-25T09:31:32+00:00

I’m writing a App that gets input from a user (First Name, Last Name,

  • 0

I’m writing a App that gets input from a user (First Name, Last Name, Phone #, Time of Reservation, Reservation Date, and How many are in the party) then sends that data to a mySQL server. I’m having trouble though. I’m new to android development so I don’t really know many tricks or ways to do things. I’ve researched this and all I have come up with is how to pull data from a database. I have my app pretty much built, I have it to where the user inputs their information and then clicks submit. When they click submit all the information they input disappeared, and nothing appears in the SQL database. Any suggestions that you guys could give, I’d appreciate it 🙂 Thanks! Below is the code I used. I found a book that was using a mySQL database and worked a lot of my code around that.

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

     intent = new Intent();
     intent.setClass(this,Reservation.class); 


final Button Submit = (Button) findViewById(R.id.xButton);
Submit.setOnClickListener(new OnClickListener() {
    public void onClick(View v) {
        // Perform action on clicks
     fName = (EditText)findViewById(R.id.xFirstName);
     lName = (EditText)findViewById(R.id.xLastName);
     phone = (EditText)findViewById(R.id.xPhoneInputBox);
     date = (EditText)findViewById(R.id.xDateInput);
     time = (EditText)findViewById(R.id.xTimeInput);
     partyNum = (EditText)findViewById(R.id.xNumberInput);

     startActivity(intent);

    }           

});


}
}
package lets.Seat;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import android.app.ProgressDialog;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

——-Reservation Class————–

public class Reservation extends Lets_SeatActivity {
ProgressDialog myprogress;
Handler progresshandler;
Message msg;

 public void run() {

     try {
         FileOutputStream os = getApplication().openFileOutput(fName.getText().toString()+lName.getText().toString()+phone.getText().toString()+date.getText().toString()+time.getText().toString()+partyNum.getText().toString(), 0);

         os.flush();
         os.close();

         // reopen to so we can send this data to server
         File f = new File(getApplication().getFileStreamPath(fName.getText().toString()+lName.getText().toString()+phone.getText().toString()+date.getText().toString()+time.getText().toString()+partyNum.getText().toString()).toString());
         long flength = f.length();

         FileInputStream is = getApplication().openFileInput(fName.getText().toString()+lName.getText().toString()+phone.getText().toString()+date.getText().toString()+time.getText().toString()+partyNum.getText().toString());
         byte data[] = new byte[(int) flength];
         int count = is.read(data);
         if (count != (int) flength) {
             // bad read?
         }
         this.msg = new Message();
         msg.what = 0;
         msg.obj = ("Connecting to Server");
         progresshandler.sendMessage(this.msg);

         URL url = new URL("---Edited out--- If you want to see my PHP file, Just ask :)");
         URLConnection conn = url.openConnection();
         conn.setDoOutput(true);
         BufferedOutputStream wr = new BufferedOutputStream(conn.getOutputStream());
         wr.write(data);
         wr.flush();
         wr.close();

         this.msg = new Message();
         this.msg.what = 0;
         this.msg.obj = ("Data Sent");
         this.progresshandler.sendMessage(this.msg);

         // Get the response
         BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
         String line = "";
         Boolean bSuccess = false;
         while ((line = rd.readLine()) != null) {
             if (line.indexOf("SUCCESS") != -1) {
                 bSuccess = true;
             }
             // Process line...
             Log.v("Lets_SeatActivity", line);
         }
         wr.close();
         rd.close();

         if (bSuccess) {
             this.msg = new Message();
             this.msg.what = 0;
             this.msg.obj = ("Reservation Sent Successfully");
             this.progresshandler.sendMessage(this.msg);

         } else {
             this.msg = new Message();
             this.msg.what = 0;
             this.msg.obj = ("Failed to make Reservation");
             this.progresshandler.sendMessage(this.msg);

             // tell caller we failed
             this.setResult(0);
         }
     } catch (Exception e) {
         Log.d("Lets Seat", "Failed to make reservation" + e.getMessage());
     }
     this.msg = new Message();
     this.msg.what = 1;
     this.progresshandler.sendMessage(this.msg);
 }

}

  • 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-25T09:31:33+00:00Added an answer on May 25, 2026 at 9:31 am

    Have you stepped through this in the debugger? Are you executing the bSuccess code block? Are you getting a response?

    I would suggest that you try to pass your data in as parameters through the url — or as JSON the way you would for AJAX.

    Here’s an example: How to send HTTP POST request and receive response?

    Here’s some code you could use: http://moazzam-khan.com/blog/?p=490

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I need to clean up various Word 'smart' characters in user input, including but
I am writing an app with both english and french support. The app requests
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I am currently running into a problem where an element is coming back from

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.