Created
December 21, 2014 22:01
-
-
Save willrax/cec906a7a4ec56983fda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Client < Android::OS::AsyncTask | |
def doInBackground(params) | |
url = Java::Net::URL.new("http://www.bom.gov.au/fwo/IDN60901/IDN60901.94768.json") | |
reader = Java::IO::BufferedReader.new(Java::IO::InputStreamReader.new(url.openStream)) | |
builder = Java::Lang::StringBuilder.new("") | |
while ((line = reader.readLine()) != nil) do | |
builder.append(line) | |
end | |
puts builder.toString | |
reader.close | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity < Android::App::Activity | |
def onCreate(savedInstanceState) | |
super | |
@content_layout = Android::Widget::FrameLayout.new(self) | |
@content_layout.setId(Android::View::View.generateViewId) | |
@content_layout.backgroundColor = Android::Graphics::Color.parseColor("#FF0099CC") | |
client = Client.new | |
client.execute({}) | |
self.setContentView(@content_layout) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment