LoginSignup
1
1

More than 5 years have passed since last update.

Android:SDカード上のHTMLファイルを表示するのに苦労したので

Posted at

はじめに

Androidタブレットで多量な画像ファイルと音楽ファイルを持ち歩きたいという要望から、WebViewを使って簡単なアプリを作ろうかとしたところ意外と苦労したので。。

タブレット端末の環境

Lenovo 501LV (Android 5.0.2, API21)

外部SDカードのパス

file:///storage/sdcard1

最初落とし穴は
「SDカード上のHTMLファイルを表示する」
でググったたこと、、

次に
Lenovo 501LVでは、getExternalStorageDirectory()
SDカードのパスがひろえなかった。。(機種によっては内部ストレージのパスを返すらしい)

で、最終的には
ログをちゃんとみてたら

D/Environment: getStorageVolume,  volume:StorageVolume:
        mStorageId=65537 mPath=/storage/emulated/0 mDescriptionId=17040812 
        mPrimary=true mRemovable=false mEmulated=true mMtpReserveSpace=10 
        mAllowMassStorage=false mMaxFileSize=0 mOwner=UserHandle{0} mUuid=null 
        mUserLabel=null mState=mounted 
D/Environment: getStorageVolume,  volume:StorageVolume:
        mStorageId=131073 mPath=/storage/sdcard1 mDescriptionId=17040810 
        mPrimary=false mRemovable=true mEmulated=false mMtpReserveSpace=0 
        mAllowMassStorage=true mMaxFileSize=4294967295 mOwner=null mUuid=0403-0201 
        mUserLabel=null mState=mounted 

mPath=/storage/sdcard1

(・・;)
ココでした。。

オワリ

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1