14 |
import android.graphics.Bitmap; |
import android.graphics.Bitmap; |
15 |
import android.graphics.BitmapFactory; |
import android.graphics.BitmapFactory; |
16 |
import android.net.ConnectivityManager; |
import android.net.ConnectivityManager; |
17 |
|
import android.net.Uri; |
18 |
|
import android.os.Environment; |
19 |
import android.util.Log; |
import android.util.Log; |
20 |
import android.widget.RemoteViews; |
import android.widget.RemoteViews; |
21 |
import dk.thoerup.androidutils.HttpUtil; |
import dk.thoerup.androidutils.HttpUtil; |
58 |
//views.setTextViewText(R.id.caption, newData.caption); |
//views.setTextViewText(R.id.caption, newData.caption); |
59 |
|
|
60 |
|
|
61 |
|
Intent viewIntent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://www.ekstrabladet.dk/side9/")); |
62 |
|
|
63 |
|
|
64 |
//View single file |
//View single file |
74 |
//viewIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker"); |
//viewIntent.setClassName("com.android.camera", "com.android.camera.GalleryPicker"); |
75 |
|
|
76 |
|
|
77 |
Intent viewIntent = new Intent(); |
/*Intent viewIntent = new Intent(); |
78 |
viewIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
viewIntent.addCategory(Intent.CATEGORY_LAUNCHER); |
79 |
viewIntent.setAction(Intent.ACTION_MAIN); |
viewIntent.setAction(Intent.ACTION_MAIN); |
80 |
viewIntent.setComponent(new ComponentName("com.android.camera", ".GalleryPicker")); |
viewIntent.setComponent(new ComponentName("com.android.camera", ".GalleryPicker")); |
81 |
viewIntent.setFlags(0x10200000); |
viewIntent.setFlags(0x10200000);*/ |
82 |
|
|
83 |
|
|
84 |
|
|
155 |
return BitmapFactory.decodeFile(file.getAbsolutePath()); |
return BitmapFactory.decodeFile(file.getAbsolutePath()); |
156 |
} |
} |
157 |
}*/ |
}*/ |
158 |
|
|
159 |
|
|
160 |
byte imageData[] = HttpUtil.getContent(data.url, 2500); |
byte imageData[] = HttpUtil.getContent(data.url, 2500); |
161 |
|
|
162 |
if (saveImage == true) { |
if (saveImage == true) { |
163 |
File savedir = new File(SAVEDIR); |
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { |
164 |
savedir.mkdirs(); |
File savedir = new File(SAVEDIR); |
165 |
|
savedir.mkdirs(); |
166 |
if (file.exists()) { |
|
167 |
file.delete(); |
if (file.exists()) { |
168 |
|
file.delete(); |
169 |
|
} |
170 |
|
|
171 |
|
FileOutputStream fos = new FileOutputStream(file); |
172 |
|
fos.write(imageData); |
173 |
|
fos.close(); |
174 |
|
} else { |
175 |
|
Log.i(TAG, "sdcard is not mounted"); |
176 |
} |
} |
|
|
|
|
FileOutputStream fos = new FileOutputStream(file); |
|
|
fos.write(imageData); |
|
|
fos.close(); |
|
177 |
} |
} |
178 |
|
|
179 |
return BitmapFactory.decodeByteArray(imageData, 0, imageData.length); |
return BitmapFactory.decodeByteArray(imageData, 0, imageData.length); |