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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:59:55+00:00 2026-06-07T07:59:55+00:00

The Andriod app I’m developing is using Http Gets/Posts using PHP files on my

  • 0

The Andriod app I’m developing is using Http Gets/Posts using PHP files on my website to perform transactions on a mysql database.

On the PHP side, I wrap the data up with JSON to parse on the java end of the app when receiving a response. I recently modified one of the tables and eliminated unnecessary values from the table. When I poll using the PHP scripts from my website, it polls correctly. When I use the app, which uses the same PHP script for polling, it returns the additional values I already removed from the database.

I’ve restarted Eclipse, cleaned the project, and restarted the android VDM to refresh it; however, it continues to find those values that were removed. Any ideas as to what is going on?

Here is the php script I’m connecting to from the app:

<?php
mysql_connect("localhost", "******", "******");
mysql_select_db("bouncet2_pogoapp");

$query = "SELECT * FROM Event_Table ORDER BY Event ASC";
$sql = mysql_query($query);

while($row=mysql_fetch_assoc($sql))
$output[]=$row;

print(json_encode($output));

mysql_close();
?>

As for my code in the app using the script:

try {
        String response = CustomHttpClient.executeHttpGet("http://www.*****.com/****/****/***/GetEvents.php");
        //System.out.println(response);

        try {
            eventArray = new JSONArray(response);
            //Log.i(SelectEventActivity.class.getName(), "Number of entries " + eventArray.length());

            m_adapterForSpinner = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item);
            m_adapterForSpinner.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

            event_Spinner.setAdapter(m_adapterForSpinner);          

            for (int i = 0; i < eventArray.length(); i++) {
                JSONObject jsonObject = eventArray.getJSONObject(i);
                m_adapterForSpinner.add(jsonObject.getString("Event"));
                //Log.i(AddJumpersActivity.class.getName(), jsonObject.getString("Event"));
            }

        } catch (Exception e) {
            e.printStackTrace();
        }           
    } catch (Exception e) {
        e.printStackTrace();
    }

The function executeHttpGet(URL) is part of a class CustomHttpClient and is as follows:

public static String executeHttpGet(String url) throws Exception {

    StringBuilder builder = new StringBuilder();
    HttpClient client = getHttpClient();
    HttpGet request = new HttpGet();
    request.setURI(new URI(url));

    try {            
        HttpResponse response = client.execute(request);
        StatusLine statusLine = response.getStatusLine();
        int statusCode = statusLine.getStatusCode();

        if (statusCode == 200) {
            Log.i(CustomHttpClient.class.toString(), "System Status OK");
            HttpEntity entity = response.getEntity();
            InputStream content = entity.getContent();
            BufferedReader reader = new BufferedReader(new InputStreamReader(content));
            String line;
            while ((line = reader.readLine()) != null) {
                builder.append(line);
            }
        } else {
            Log.e(CustomHttpClient.class.toString(), "Failed to download file");
        } 
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }

    return builder.toString();            
}
  • 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-07T07:59:57+00:00Added an answer on June 7, 2026 at 7:59 am

    It looks like your response is getting cached somewhere, ether in a cache server between your phone and your server, or in the phone itself.

    If the cache is happening outside the phone, adding the appropriate headers to disable caching would do the trick. This would be added to the headers of the response by the server. There are several ways to do this, but I think this should work…

    header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
    

    On the phone side, depending on the HTTP Client you get from getHttpClient, it could be a client which has caching turned on. In Ice Cream Sandwich, Google added caching to the HttpURLConnection HTTP Client. Caching has to be turned on according to the docs, but many people seem to have issues with the cache being on when they where unaware. I’m not to familiar with the interworkings of the various HTTP Clients on Android, but this should be a good start…

    http://developer.android.com/reference/java/net/HttpURLConnection.html

    A quick and dirty check to see if something is caching the response would be to add a random, unused param to your URL when calling the server, something like…

    url += "?unused=" + UUID.randomUUID();
    

    With this in place, you should not get cached anywhere, then you can at least determine if it is a caching issue or something else, and go from there.

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

Sidebar

Related Questions

I have the following layout for my andriod app. <?xml version=1.0 encoding=utf-8?> <TableLayout xmlns:android=http://schemas.android.com/apk/res/android
How to develop an iPhone app using its webviewer? Like in Andriod we can
My android app needs to perform Http requests through HttpClient. i've tested on the
The android app reads from database but doesnt write anything to DB, the app
I've got a basic Andriod app that has a button and a gridview on
My android-app gets List in the one activity, but activity,that contains the LisView for
Just wondering if anyone can help me in andriod app development. I'm new to
I was trying a quick tutorial using google maps in Andriod When I load
I have developed an Andriod RSS reader app.I have used custom listview to list
import android.app.Activity; import android.content.ContentResolver; import android.content.Intent; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; import android.provider.Contacts.People;

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.