Time of Update: 2018-12-03
在使用initLoader()方法時,如果指定ID的裝載器存在,就使用這個既存的裝載器,否則會建立一個新的。但是有些時候你會想要廢棄舊的資料並重啟裝載器。你可以使用restartLoader()方法來廢棄舊的資料。例如,SearchView.OnQueryTextListener的實現就會在使用者查詢改變時重啟裝載器。裝載器需要重啟以便能夠使用修正後的搜尋過濾器來進行新的查詢,如:public boolean onQueryTextChanged(String newText) { //
Time of Update: 2018-12-03
本文譯自:http://developer.android.com/reference/android/widget/ArrayAdapter.html繼承關係java.lang.Object |___android.widget.BaseAdapter
Time of Update: 2018-12-03
複製流化的資料你可以複製和粘貼被流化的大文本和位元據。這種資料可以是以下形式:1. 儲存在實際裝置上的的檔案;2. 來自通訊端中的資料流;3. 儲存在底層資料庫系統中的大資料。針對資料流的內容提供器使用一個檔案描述對象(如AssetFileDescriptor,而不是Cursor對象)來提供對資料的訪問。粘貼資料的應用程式會使用這個檔案描述對象來讀取資料流。按照以下步驟建立使用提供其來複製資料流的應用程式:1. 建立一個準備放入剪貼簿上的資料流所對應的內容URI。包括以下可選的內容:
Time of Update: 2018-12-03
複製結構性資料為了複製和粘貼複雜的資料,你可以建立一個繼承ContentProvider組件的內容提供器。你還應該把要放到剪貼簿上的URI編碼,以便它指向你想要提取的資料。另外,你必須要考慮你的應用程式的存在狀態:1. 如果你已經有了一個內容提供器,你可以給它添加功能。你可能只需要修改它的query()方法來處理粘貼資料的應用程式所輸入的URI。為了處理“copy”URI的模式,也可能會修改這個方法。2. 如果你的應用程式維護了一個內部的資料庫,你可能想要把這個資料庫移到內容提供器中,為從中複製
Time of Update: 2018-12-03
調整儲存電池電量和資料交換的模式在你測試你的應用程式時,你可能會發現,為了提供良好的位置和效能,可能需要對模式進行某些調整。以下是在這兩者之間尋求良好平衡時可能要改變的一些事情。減少視窗的尺寸用一個較小的視窗來允許監聽位置的更新,意味著與GPS和網路位置伺服器進行的互動較少,這樣就能夠延長電池電量使用周期。但它也允許從較少的位置中選擇一個最好的估算結果。給位置提供器設定較低的更新頻率減少位置更新在視窗中顯示的頻率也能夠改善電池利用效率,但會影響精確度。這個值的權衡要依賴於如何使用你的應用程式。通
Time of Update: 2018-12-03
本文譯自:http://developer.android.com/training/camera/videobasics.html本文介紹如何使用既存的Camera應用程式來拍攝視頻。如果你的應用程式只是要整合很小一部分的視頻功能,那麼你可以使用大多數Android裝置上已經提供的Camera應用程式來拍攝視頻。申請Camera許可權在資訊清單檔中放一個<uses-feature>標籤,給你的應用程式申請對網路攝影機的依賴:<manifest ...>
Time of Update: 2018-12-03
本文譯自:http://developer.android.com/guide/topics/sensors/sensors_overview.html大多數的Android裝置都有內建的測量運動、方向、和各種環境條件的感應器。這些感應器具有提供高精度和準確度的未經處理資料的能力,可用於監視裝置在三維方向的移動和位置、或者監視裝置周圍環境的變化。例如,一個遊戲可能要從重力感應器中讀取軌跡,以便推斷出複雜的使用者手勢和意圖,如傾斜、震動、旋轉或擺動等。同樣,有關天氣的應用程式可能要使用裝置的溫度感
Time of Update: 2018-12-03
本文譯自:http://developer.android.com/guide/topics/appwidgets/index.htmlApp Widgets是一些較小的應用程式視窗,它們能夠被嵌入到其他的應用程式中(如主屏視窗),並且能夠接受周期性的更新。這些小視窗可以作為使用者介面中的一個可視組件,而且這些可視組件也可以帶有自己的App Widget提供器。能夠持有其他App Widgets的組件被叫做App Widget的持有人。以下是Music App
Time of Update: 2018-12-03
Api Level 3: (SDK
Time of Update: 2018-12-03
The new Android 1.5 Early Look SDK is out since a few weeks. The"Android 1.5 highlights" page does not mention one highlight, which IMHO will become very important for all developers on the Android platform because it allows you to find memory
Time of Update: 2018-12-03
A few days ago I started to learn android… and it’s been a fairly smooth transition from flash. Although I have to say, as flash developers we’re just spoiled. We take for granted all the background stuff flash does for us to make coding that much
Time of Update: 2018-12-03
擷取Android原始碼原始碼在哪裡?你可以通過http://android.git.kernel.org訪問andorid 源碼倉庫。源碼大約2.1GB,你需要6GB的空間完成整個源碼的build。搭建PC build環境Linux (推薦使用ubuntu)ubuntu Linux 32-bit x86 machine需要的軟體包:. Git 1.5.4 or newer. JDK5.0 / JDK6.0 (事實上目前這兩種版本均可使用,需要check
Time of Update: 2018-12-03
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallerylayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <Gallery android:id="@+id/overview"
Time of Update: 2018-12-03
1,android:orientation 布局方向。horizontal是讓所有的子項目按水平方向從左至右排列, vertical是讓所有的子項目按豎直方向從上到下排列。 2,android:gravity 與 android:layout_gravity的區別android:gravity是指定本元素的子項目相對它的對齊。 android:layout_gravity是指定本元素相對它的父元素的對齊。 例如:
Time of Update: 2018-12-03
https://github.com/fgp/AirReceiverAirReceiver===========Florian G. Pflug <fgp [at] phlo.org>May 2011Overview--------AirReceiver is an AirPort Express emulator, i.e. it allows streaming audiofrom iTunes and iOS devices to a computer running
Time of Update: 2018-12-03
//decodes image and scales it to reduce memory consumption private Bitmap decodeFile(File f){ try { //Decode image size BitmapFactory.Options o = new BitmapFactory.Options(); o.inJustDecodeBounds = true;
Time of Update: 2018-12-03
/* * Copyright (C) 2012 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *
Time of Update: 2018-12-03
Android功能強大,介面華麗,但是眾多的布局屬性就害苦了開發人員,下面這篇文章結合了網上不少資料,花費本人一個下午搞出來的,希望對其他人有用。第一類:屬性值為true或falseandroid:layout_centerHrizontal 水平置中android:layout_centerVertical 垂直置中android:layout_centerInparent 相對於父元素完全置中android:layout_alignParentBottom
Time of Update: 2018-12-03
前面我們介紹過Android的一個縮圖控制項Gallery,以及一個網格顯示空間,都分別用圖片作為例子,但我們真正用來顯示圖片的有這樣一個控制項,叫ImageSwitcher,顧名思義,意思就是映像轉換器,我們常用它來顯示Android的UI中圖片,當然我們也可以用ImageView來操作,但ImageSwitcher具備一些特定的功能,就是它本身在轉換圖片的時侯可以增加一些動畫效果。布局中的聲明及其簡單,跟一個時鐘控制項一樣簡單。<ImageSwitcher
Time of Update: 2018-12-03
目前Android平台有三種網路介面可以使用,他們分別是:java.net.*(標準Java介面),org.apache(Apache介面),和android.net.*(android網路介面)。1 標準Java介面java.net.*提供與連網有關的類,包括流和資料包通訊端、Internet協議、常見HTTP處理。比如:建立URL以及URLConnection/HttpURLConnection對象,設定串連參數 ,串連到伺服器 ,向伺服器寫資料 ,從伺服器讀取資料