Android之資料存放區

來源:互聯網
上載者:User

標籤:android   strong   檔案   資料   資料庫   sql   

概述

1.android中包含5中資料存放區方式:

    SharedPreferences儲存資料。

    ContentProvider儲存

    檔案儲存體

    SQLlite資料庫儲存

    網路儲存

Preference  File   DataBase 這三種方式分別對應的目錄是:

/data/data/Package Name/Shared_Pref 

/data/data/Package Name/files 

/data/data/Package Name/database

簡單資料和配置資訊,SharedPreference是首選;

如果SharedPreferences不夠用,那麼就建立一個資料庫;

結構化資料,一定要建立資料庫,雖然這稍顯煩鎖,但是好處無窮;

檔案就是用來隱藏檔(也即非配置資訊或結構化資料),如文字檔,二進位檔案,PC檔案,

多媒體檔案,下載的檔案等等;

盡量不要建立檔案;

如果建立檔案,如果是私密檔案或是重要檔案,就儲存在內部儲存,否則放到外部儲存

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.