[ANDROID] Download URL Contents with HTTPClient?

Discussion in 'Programming' started by ColorWP.com, Aug 11, 2011.

  1. #1
    Hello.

    Essentially, the only thing I have problem is getting the contents of a page (with POST data sent). It's very easy to do in PHP+CURL, but Android is giving me hassles.

    Now from the beginning...

    I've just started android development and since I have no previous experience with Java, you can guess that it's very complicated to me, even though that I have years of experience with PHP.

    The thing is that I want to build an Android application with the following functionality:

    1. EditText field where user enters an URL (e.g. from Youtube).
    2. Download button.
    3. Result text (right below the button, initially invisible).

    I have this layout structure (main.xml):
    http://pastebin.com/yKvxtG6T

    Strings.xml:
    http://pastebin.com/wB1gSu8K

    And the real Java file looks like this:
    http://pastebin.com/2QUwAwRb

    However, I don't know how to proceed from here to do the following functionality:
    1. Split the URL and use one of the request values (e.g. "?video_id=4S5kDk")
    2. Post this data to a secondary URL (e.g. as post data to "example.com/process.php")
    3. Get the resulting page's contents and display it as text for the hidden result TextView.

    Note: It's not a Youtube downloader. I am giving Youtube as an example of what I'm trying to accomplish.

    Anyone can help with that?
     
    ColorWP.com, Aug 11, 2011 IP