Http server at localhost

by » Fri, 04 Sep 2009 07:50:42 GMT

Sponsored Links
 Is it possible to do something like WebView#loadUrl(" 
index.html") with service acting as local http server? Where would one
start? Will I need at least partial http server implementation that
would listen on the socket?

Http server at localhost

by Chris Stratton » Fri, 04 Sep 2009 09:25:38 GMT

 Yes and you have the right idea about needing something that will
listen on a socket, but you will probably need to put it on a higher
port number and include that in the URL, since on most linuxes non
privileged processes cannot claim low port numbers such as 80.   Port
8080 was often used in the old days...

You could do this by porting some compact embedded linux http server
by abusing the ndk toolchain, but the android folks would say it's
better done in java


Sponsored Links

Http server at localhost

by » Fri, 04 Sep 2009 11:05:52 GMT

 Oh boy, there's java web server 4 kilos in size I 
wonder though what would be faster - doing WebView#loadUrl from such
server or WebView#loadDataWithBaseUrl from value stored in the
preferences. In any event - first one will be cached by browser, with
history provided which is not a small gain, plus - I can store files
for that webserver on the card.
I will try this tonight,

Thanks Chris!


Http server at localhost

by dilli rao » Fri, 04 Sep 2009 11:28:44 GMT

 you can set a http server running in the local machine (Android)and you can
uset it as a simple server

try to port the server in android (as it is ) no modifications required.... 

<> ;in

and use it it works for my requirements very well

may be it will use full for you

Thank you



Http server at localhost

by Thomas (geomancer) » Fri, 04 Sep 2009 18:58:58 GMT

Like Duh on  my part, but what would a local server listen for?
Tom B


Http server at localhost

by Haravikk » Fri, 04 Sep 2009 21:12:19 GMT

 Does Android include support for Servlets? As you could possibly just
use an HTTP servlet to serve-up pages, using JSP as well if that's
supported, both are pretty neat ways to do that. Unless you're hoping
to use PHP or something for fancy pages, but I'd steer well clear of
that personally, and go for the all java solution (JSP served using an
HTTP servlet).


Http server at localhost

by Mark Murphy » Fri, 04 Sep 2009 21:21:54 GMT

 > Does Android include support for Servlets?

Android does not have a built-in HTTP server, let alone a servlet engine.

Mark Murphy (a Commons Guy) 
Android App Developer Books: 


Http server at localhost

by Neil » Fri, 04 Sep 2009 21:49:54 GMT

 I think jetty is the thing you're looking for: 



Http server at localhost

by » Fri, 04 Sep 2009 23:35:22 GMT

 WebView#loadUrl(" :8080/index.html")


Http server at localhost

by » Fri, 04 Sep 2009 23:41:09 GMT

 Oh my God! Access your phone from the browser - I'm going to be
sick... Beyond brilliant!


Other Threads

1. How to share datas between tabs in a TabActivity


I created a TabActivity with contains 3 tabs. Each tab's content sets
different Intents. All these Intents extended ListActivity.

Is it possible to retrieve informations from these three activities in
the main TabActivity?

Here are some of my codes :

public class Temp extends TabActivity{

            protected void onCreate(Bundle savedInstanceState) {
                final TabHost tabHost =  getTabHost();

                // First tab
                TabHost.TabSpec userTab = tabHost.newTabSpec();
                secTab.setContent(new Intent(this,Activity2.class));

                // Second tab
                TabHost.TabSpec secTab = tabHost.newTabSpec();
                secTab.setContent(new Intent(this,Activity2.class));

                // Third tab
                TabHost.TabSpec thirdTab = tabHost.newTabSpec();
                thirdTab.setContent(new Intent(this,Activity3.class));


Precisely, I would like to get datas from "Activity1", "Activity2" and

Best regards


2. Where do we have to close the DB in a ContentProvider?

Maybe it an easy question, but Ie tried to understand why all the
content providers seem not to close the DB that they use. In the
NotePadProvider example (in other providers is similar), it used a
Helper to manage the DB (that extends of SQLiteOpenHelper). This
helper has a method to close the DB (
but in all the providers that I have seen (even in the example), this
method is never used.

For example, in the query method of the NotPadProvider we use the
helper to open a DB

// Get the database and run the query         SQLiteDatabase db =
mOpenHelper.getReadableDatabase();         Cursor c = qb.query(db,
projection, selection, selectionArgs, null, null,
orderBy);          // Tell the cursor what uri to watch, so it knows
when its source data changes         c.setNotificationUri(getContext
().getContentResolver(), uri);         return c;

the mOpenHelper is create in the nCreate()method, but there is no
reference to a mOpenHelper.close() in all the provider (maybe because
there is no lose()method in ContentProvider).

Do we need to close the SQLiteOpenHelper object? When we use it inside
a ContentProvider, where is the right place to close it?

Thanks in advance.


3. How to get JUnitReports via android.test.InstrumentationTestRunner

4. if current android supports 3GPP Rel-8 SMS extended character table?

5. Can i use RotateAnimation to make a Drawable rotate?

6. unable to add a new layout.xml

7. circular zoom in magic