Making part of HttpClient behave like WebView

by Matthew1471 » Thu, 03 Mar 2011 04:27:48 GMT

Sponsored Links

I observe the web-browser allows you to view dodgy SSL certificates
(and cancel/ignore) for https sites that self sign. The built-in HTC
Mail application provides similar functionality when you use IMAPS.

So after downloading the browser (and then webkit) source from git I
have found all the bits I would want to implement in my HttpClient
based program: SSL_ERROR:
                            (SslErrorHandler) map.get("handler"),
                            (SslError) map.get("error"));


...public void onReceivedSslError(SslErrorHandler handler, SslError
error) {
        if (mWebViewClient == null) {

Where handler.cancel() stops the site from running and
handler.proceed() allows it to continue (SslError contains both the
error and certificate that caused it).

How can I make the *Apache HttpClient* pass an event that allows the
user to view the certificate and ignore or continue (with the view to
databasing any allowed exceptions). Surely WebKit uses the HttpClient
behind the scenes so a method to register for call-back events such as
onRecievedSslError must exist?

I know, yes, you can implement your own trustedstore (I want my users
to connect to their own servers) or even your own SSLSocketFactory (to
over-ride checkServerTrusted etc) I do not feel brave enough to want
to do that, I would rather let the phone decide it is invalid and then
let the user over-ride it rather than forget to implement a crucial
check and risk making the SSL completely pointless.

Any help on how to get the HttpClient into that handler.cancel or
handler.proceed state would be much appreciated.

Thanks for your time,


Other Threads

1. InstrumentationTestCase: Scrolling a listview to be able to click info icon associated with each item on the list

I am writing my android JUnit tests in InstrumentationTestCase class.
I would appreciate any help with the following scenarios as I tried
all the ways that I could think of, but with no luck.

I need to:

  1) Vefiry that the list actually scrolled (I mean verify that the
screen content changed when scrolled)
  2) Scroll a list view to be able to click on info button associated
with each item on the list when the list spans across screens.

Say there are 25 entries in the list and each screen can fit 10
entries. I need to iterate through the list and click the info button
associated with each item on the list and do some verifications. It
works fine for all the items on the first screen, but when the button
to be clicked is for the 11th and subsequent items in the list, it
fails, so I need to scroll to the next screen.

I was hoping that calling TouchUtils.dragQuarterScreenUp(this,
activity) 4 times would scroll one full screen, but it is not
scrolling exactly one screen.

I tried TouchUtils.dragViewToY by giving the offset by calculating:

int iScrollToY = childView .getHeight() * (listView.getChildCount() +
1); //assuming this is the Y coordinate of the 1st item on the next

In the code above, listView is the ListView that displays all the
items and childView's value is listView.getChildAt(iLoopCounter):

int iScrollToY = childView.getHeight() * (listView.getChildCount() +
1); //assuming this is the Y coordinate of the 1st item on the next

I tried several other values to pass to the y coordinate, they all
scroll but not by the value that I need. I see that TouchUtils has a
lot of drag methods, I am sure one of them can scroll by the number of
items in the list, but I am unable to figure out what to pass to the
pixel values for these drag/scroll methods.

when I try to use listView.scrollTo(x, y) with some values that I
thought would work, give the following error as the list view is not
created by my code but I am just testing the existing code:

android.view.ViewRoot$CalledFromWrongThreadException: Only the
original thread that created a view hierarchy can touch its views.

Can somebody please let me know the Y coordinate value that I need to
pass to one of these drag/scroll methods in TouchUtils to be able to
iterate through each item in the list( by either scrolling one item at
a time or one whole screen after visiting all the items on one screen)
or any other means to just scroll the ListView by passing as an
argument the number of list items to scroll.

Even if I can not see the list, that's ok as long as I can click the
info button corresponding to each item on the list by some how
scrolling the listview.

Thank you very much for reading this long post and thanks in advance
for your help.


2. Bad sound quality when recording/playing sounds...

Hey, I have a problem with andriod programing when I try to record and
then play the file that was just recored. I can both record and play
the sound but the quality stinks. Its not just bad is really hard to
listen to and sound abit like its a computer generated voice... I use
the andriod SDK-emulator. The code that sets up the recording looks
like this;

MediaRecorder recorder = new MediaRecorder();
And the code playing the file later looks like this;

MediaPlayer mp = new MediaPlayer();
I dont know what part that makes the audiofile sound really bad... or
if its just the emulator that makes it bad and that it would work on a
real phone. I would love some help with this.



3. Buffering problem while reading an h264 video (using HTTP protocol).

4. Yahoo Mail Setting for your Mobile

5. jsonarray as spinner source

6. New OMX component integration into Opencore

7. android market account still ask for payment...