From e8f4fe9a7b38cc0099ee7ec8d536a15c9df0c1df Mon Sep 17 00:00:00 2001 From: tokugawa Date: Sat, 19 Apr 2014 16:37:08 -0400 Subject: [PATCH] Added image download functionality --- UNCCScavenger/res/layout/activity_search.xml | 7 +++ .../src/edu/uncc/scavenger/MainActivity.java | 3 ++ .../edu/uncc/scavenger/SearchActivity.java | 43 +++++++++++++++++-- 3 files changed, 49 insertions(+), 4 deletions(-) diff --git a/UNCCScavenger/res/layout/activity_search.xml b/UNCCScavenger/res/layout/activity_search.xml index 868855f..d4423c5 100644 --- a/UNCCScavenger/res/layout/activity_search.xml +++ b/UNCCScavenger/res/layout/activity_search.xml @@ -13,6 +13,13 @@ android:layout_weight="1" android:orientation="vertical" > + + { + @Override + protected Bitmap doInBackground(String... params) { + try + { + URL imageUrl = new URL(params[0]); + return BitmapFactory.decodeStream(imageUrl.openStream()); + } + catch(Exception e) + { + e.printStackTrace(); + } + + return null; + } + + @Override + protected void onPostExecute(Bitmap result) { + + locationImage.setImageBitmap(result); + } + } }