文章

顯示從 七月, 2010 起發佈的文章

Android 開發項目 - RSS Reader

第一階段 - Website 的 RSS 直接透過 RSS Reader 讀取,讓 Reader 可以用 App 直接睇 News - 全部階為 Online 環境操作, 必須上網才可使用 - 要用 ListView 來操作 第二階段 - Click 入 Heading 後顯示內文,並將圖片也一併顯示 第三階段 - 讓用戶選擇 Offline Reading / Online Reading - 將資料寫入 Database, 每次可讓用戶選擇是否要網上更新

How to display a JPG in sdcard on ImageView

圖片
How to display a JPG in sdcard on ImageView To display a JPG on ImageView, BitmapFactory.decodeFile() can be used. But, in my experience, if I try to display a original photo in 10.0 million pixels by Nikon D80, the application will be stopped unexpectedly. So I have to use options.inSampleSize to reduce sample size. In this exercise, the source (myJpgPath) of the JPG file is fixed, "/sdcard/DSC_3509.JPG". You have to modify to suit your own case. Modify main.xml to have a TextView and ImageView to display files name and the photo. Modify the java file package com.exercise.AndroidJpgView; import java.io.File; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.widget.ImageView; import android.widget.TextView; public class AndroidJpgView extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState)