How to do a google search?

by Mattaku Betsujin » Fri, 06 Mar 2009 16:06:17 GMT

Sponsored Links
 I want to do a google search, so I open an HttpURLConnection() to However, I am getting an error:

url = ;q=123 ;q=123
   at com.nubinews.reader.URLFetcher.readHttp(

and the response headers are:

HEADER: null = HTTP/1.1 403 Forbidden
HEADER: content-type = text/html; charset=UTF-8
HEADER: date = Fri, 06 Mar 2009 08:02:53 GMT
HEADER: server = gws
HEADER: cache-control = private, x-gzip-ok=""
HEADER: transfer-encoding = chunked

What should I do?


How to do a google search?

by Mattaku Betsujin » Fri, 06 Mar 2009 16:31:34 GMT

 I found a work-around. Instead of using HttpURLConnection, I open a socket
connection directly to and was able to get the search
results (in HTML data). It seems like Android's HttpURLConnection adds
request header to make my life miserable.

However, when I tried to print the request headers

        Map map = http.getRequestProperties();

It shows an empty collection.

What's happening? Does Google really doesn't want me to search? Please, I
beg you, let me search ........

On Fri, Mar 6, 2009 at 12:06 AM, Mattaku Betsujin <


Sponsored Links

How to do a google search?

by Mariano Kamp » Fri, 06 Mar 2009 19:09:42 GMT

 Just out of curiosity, have you tried the url without the "&"?. Afaik the
first parameter is passed in with a "?" and just the following parameters
are prefixed with the "?". But you did both for the first parameter.

On Fri, Mar 6, 2009 at 9:06 AM, Mattaku Betsujin <


How to do a google search?

by Mariano Kamp » Fri, 06 Mar 2009 19:14:47 GMT

 > It seems like Android's HttpURLConnection adds request header [to make my
life miserable.]
How do you know?

The HTTPUrlConnection works fine for me. The documentation is a bit lacking,
but since I found the following code I am happy: #uX1GffpyOZk/core/java/android/net/http/

On Fri, Mar 6, 2009 at 9:31 AM, Mattaku Betsujin <


How to do a google search?

by Mark Murphy » Fri, 06 Mar 2009 19:59:03 GMT


You do realize that what you are trying to do violates Google's Terms of
Service, right? 

If you want to use Google's search, use their official APIs for search: 

Mark Murphy (a Commons Guy) 
_The Busy Coder's Guide to Android Development_ Version 2.0 Available!


Other Threads

1. Question about AlphaAnimation

I'm having trouble getting AlphaAnimation to work.  Can anyone explain
why the following patch to in the
provided samples does not produce an image that fades away?

---  2010-04-05 12:56:45.000000000 -0500
+++       2010-04-05 12:57:39.000000000 -0500
@@ -46,7 +46,8 @@
             Drawable dr =
             dr.setBounds(0, 0, dr.getIntrinsicWidth(),

-            Animation an = new TranslateAnimation(0, 100, 0, 200);
+            Animation an = new AlphaAnimation(1.0f, 0.0f);
             an.initialize(10, 10, 10, 10);

I know that the Drawable properly responds to setAlpha().  I also
tried ensuring that the Transformation in was
setTransformationType(Transformation.TYPE_BOTH), even though I suspect
that is the default setting.

Is there some requirement of the View to allow for animated alpha
transparency that I'm missing?

Thanks for any help or explanation.



2. Question about stopping AlarmManager.

I have a AppWidget, after I delete it from HomeScreen it seems not stopping
the AlarmManager attached with it. I have supported it with the AlarmManger,
that call the ProviderImplementation class every 1 minute and in onReceive I
put the code to call onUpdate. and in onDelete I explicitly stop the alarm,
but it seems it is running continously and not stopping. any cure of it ?

I have stopped it with cancel(pendingintent) function.

thank you,
Abdul Ma{*filter*}.


3. IPv6 Problem solved

4. SDK2.1, WVGA800 return wrong getWidth(), getHeight()

5. SDK won't install

6. commands to sent to device to run JUnit tests

7. Animal translate..