The document discusses various techniques for developing Android applications that work across different device configurations and Android platform versions. It covers topics like screens sizes and densities, different layouts, using fragments and activities, leveraging new APIs while maintaining backwards compatibility, and using fallbacks and workarounds to support older platforms.
16. Layout Manager
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to
terms described in the Creative Commons 2.5 Attribution License.
21. Spezialisierte Layouts
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to
terms described in the Creative Commons 2.5 Attribution License.
22.
23. Ab wann ist man Tablet?
layout-‐v11/
layout-‐land/
layout-‐xlarge/
layout-‐sw600dp/
layout-‐sw720dp/
24. Activity vs. Fragment Control
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to
terms described in the Creative Commons 2.5 Attribution License.
27. Android À la carte
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to
terms described in the Creative Commons 2.5 Attribution License.
28. Android À la carte - APIs
Intent
i
=
null;
if(android.os.Build.VERSION.SDK_INT
>=
android.os.Build.VERSION_CODES.JELLY_BEAN)
{
i
=
new
Intent(this,
JellyBeanActivity.class);
}
else
i
=
new
Intent(this,
DefaultActivity.class);
29. Android À la carte - APIs
LocationUpdateRequester
LegacyUpdateRequester
FroyoUpdateRequester
GingerBread
UpdateRequester
http://code.google.com/p/android-protips-location/
30. Android À la carte - APIs
CompatLib
CustomImpl
Wrapper
31. Android À la carte - Ressourcen
values/bools.xml
<resources>
<bool name="ICS">false</bool>
<bool name="preICS">true</bool>
</resources>
values-‐v14/bools.xml
<resources>
<bool name="ICS">true</bool>
<bool name="preICS">false</bool>
</resources>
32. Android À la carte - Ressourcen
<service android:name=".ICSService"
android:enabled="@bool/ICS">
</service>
33. Android À la carte - Ressourcen
Layout
Layout-‐v14
Header
Header
Content
Content
34. Android À la carte - Ressourcen
Layout
Layout-‐v14
<include/>
Header
<include/>
Content
Content
46. Fallbacks / Workarounds
<manifest ... >
<supports-screens
android:smallScreens="false"
android:normalScreens="false"
android:largeScreens="true"
android:xlargeScreens="true"
android:requiresSmallestWidthDp="600" />
...
<application ... >
...
</application>
</manifest>
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to
terms described in the Creative Commons 2.5 Attribution License.
47. Fallbacks / Workarounds
<manifest ... >
<compatible-screens>
<!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>
...
<application ... >
...
<application>
</manifest>
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to
terms described in the Creative Commons 2.5 Attribution License.