Get list from Website ( PHP , MySQL , HTTP request , XML )

by DemOlitioN » Fri, 10 Apr 2009 01:55:00 GMT

Sponsored Links
 m having a problem.

I am trying to build a software that communicates with a website.
simply, i would like to have a php webpage that when i click a button
it creates an alert on the phone.

I planned on doing that by using a mysql database to with the website
where the click from the webpage will update the database, then the
mobile phone will (at intervals) make a request to the webpage or
database to retrieve that info.

Here's what im thinking of using:
Android OS
Windows Mobile OS

I found a tutorial from Apress called 'Apress Android Tutorials July
2008' and found an example that was about 90% similar to what i want
(with the source code) but when i try it i get errors and I cant find
a way to contact Apress(site is down etc)

The example was called Chapter 5: Loading a List from the Web. when i
use eclipse with the source, the error i get is "UIThreadUtilities
cannot be resolved". I noticed that when i excluded the rest of the
code and specify to import UIThreadUtilities it doesnt work.

I know this message is a bit long and it involves a lot but If anyone
can please help:

1. request i send them the source code from Apress to see if it works
on their eclipse. So I know how to fix it.


2. recommend an alternative way for me to pull info from a URL(or php
page) or a database.

Heres the code its supposed to pick a list of radio stations via xml
parsing from a web location:
I get errors where it says UiThreadutilities and other related places


import java.util.List;
import java.util.Vector;

import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.DefaultHttpClient;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.XMLReader;

import android.content.Context;
import android.os.Bundle;
import android.speech.recognition.Logger;
import android.util.Log;
import android.view.UIThreadUtilities;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnFocusChangeListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

public class StationPicker extends ListActivity {

Vector<StationData> stationListVector = new Vector<StationData>();
SAXParser parser = null;
XMLReader reader = null;
XMLHandler handler = new XMLHandler();
ArrayAdapter<StationData> adapter = null;
Activity ctx = this;

class XMLHandler implements org.xml.sax.ContentHandler
StationData currentStation;
String lastName;

public void endDocument(){}
public void endPrefixMapping(String prefix){}
public void ignorableWhitespace(char[] ch, int start, int
public void processingInstruction(Strin

Get list from Website ( PHP , MySQL , HTTP request , XML )

by Mark Murphy » Fri, 10 Apr 2009 06:17:57 GMT


That tutorial is rather old from the standpoint of Android. Most
tutorials written before September 2008 will require some amount of
modification to work on current Android SDK editions.

That class was removed from the SDK, IIRC.

Use a more up-to-date resource!

There are many open source Android projects on and Many of these download data off of the Web. For example,
there projects in the apps-for-android project on Google Code that work
with Flickr's API.

There are several books on Android, at least some of which have their
source code available for download, and some of which cover HTTP
operations. For example, you can download the source code for my book
off of Other books and programming 
resources can be found on my knol: 

For HttpClient proper, there are examples out on their site: 

Mark Murphy (a Commons Guy)  | 

Android App Developer Books: 


Sponsored Links

Other Threads

1. regarding soap client and webservices

Hi Every One

i am new to web services

I have a created a Php Script in the server having a method name
having three rows in the database are names images and rating field
having 20 names nearly

how to get the data in the Android screen in the form of table layout
or list view ?

I am used for this nusoap php web services and Mysql.

i have written a code for android soap client but i am not how call
that method and field in database

there will great appreciation for this solution..

Thanks in advance

2. Google I/O 2008 - Dalvik VM Internals - implicit labeling

On Wed, Jun 24, 2009 at 11:54 AM, Marek

As an example first of *explicit* labeling, if you look inside a
.class file, you will find that many parts of it are represented as
tagged attributes, where the tag identifies the attribute, say, as a
method body, a default field value, a line number table, etc. Those
attribute tags are generally two-byte references to constant pool
entries for string constants, and though two bytes may not sound like
much, they add up. Similarly, each entry in the constant pool for a
.class is preceded by a byte identifying its type, and these also add

In the dex format, on the other hand, in representing the vast
majority of data, such labeling is omitted, because the format itself
implies the type of data being represented. Bytecode arrays are known
to be bytecode arrays because they are pointed at from a known offset
in a method structure; and that method structure is known to be a
method structure, since it is referred to at the right point in a
class definition structure; and that class definition structure is
known to be a class definition structure, because it is within the
class definition array pointed at by the dex file header. It's all
implicit; no tagging required.

The dex format does provide an "escape valve" for arbitrary tagged
data in the form of annotations. Dex annotations are used to represent
annotations as written in the original source code, but they are also
used for a couple of things that are represented as tagged attributes
in .class files. For example, metadata about inner classes is
represented in dex files using the annotation mechanism.

You can refer to the dex format spec for more details, under
<dalvik/docs> in the source.




3. Multiselect List View and Key Event

4. OnSharedPreferenceChangeListener not listening anymore in 1.5??

5. how to create thumbnail generated after ending video recording

6. How to get the Xml response from the nusoap PHp web services