Google I/O 2012 - Multi-Versioning Android User Interfaces

Google for Developers · 26K views · 2012 · 48:22

Open on YouTube

Software architecture & designWeb developmentSoftware (other)talkdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about Android version targeting, tablet and phone layouts, and whether to use Fragments or Activities.

Recommended by 3 people across 3 different months, 2011 to 2016.

What it is

A Google I/O 2012 session by Android engineers Bruno Oliveira and Adam Powell on building user interfaces that work consistently across Android versions from Eclair onward. It covers the Action Bar, Fragments, styles, size qualifiers, app structure and navigation.

What people said

Recommends Nicolas Raoul · 2011-10 · Stack Overflow · on “How to decide what will be the target android version?”

Set your android:targetSdkVersion to whatever is the last Android SDK version. Quote from Bruno Oliveira at Google IO [this video] : targetSdkVersion does not affect the minimum SDK level required to run your application. It should always be the latest version that you are aware of. The only reason you could have to use a lower version would be to detect incompatibilities, but that is not a good reason because Lint [LINK] does this better. BUT set your android:minSdkVersion to as low as your app will run on. That's the important one. For instance, my app [LINK] uses very new features, but I set android:minSdkVersion to 3 (which means Android 1.5). My code detects Android 1.5 devices, and uses les

Recommends Arun C · 2013-04 · Stack Overflow · on “Difference in layouts composing for older Android OS versions”

See this video Multi-Versioning Android User Interfaces [this video] This will show you how to build user interfaces that work consistently across Android versions, from Eclair to today. We'll cover topics including the Action Bar, Fragments, style, size qualifiers, app structure, and navigation.

Recommends Raghunandan · 2013-04 · Stack Overflow · on “Restricting apk size - Even with large number of resources?”

You can enable ProGuard in release mode. The ProGuard tool shrinks, optimizes, and obfuscates your code by removing unused code and renaming classes, fields, and methods with semantically obscure names. The result is a smaller sized .apk file that is more difficult to reverse engineer. [LINK] . Also have a look at the video in the link [this video] . The talk is about multiversioning. Tips for reducing .apk file size [LINK]

Recommends Raghunandan · 2013-05 · Stack Overflow · on “How to provide support for tablets in Android”

Its better to use fragments in case of tablets. Check the Basic Guidelines in the below link [LINK] For supporting multiple screen provide different drawables and layout [LINK] You will have to mention support screens in your manifest file <supports-screens android:resizeable=["true"| "false"] android:largeScreens="true" android:xlargeScreens="true"/> You will have to have different layout xml files res/layout/my_layout.xml // layout for normal screen size ("default") res/layout-small/my_layout.xml // layout for small screen size res/layout-large/my_layout.xml // layout for large screen size res/layout-xlarge/my_layout.xml // layout for extra large screen size res/layout-xlarge-land/my_layou

Recommends Raghunandan · 2013-05 · Stack Overflow · on “Activity not picking up the correct orientation”

check this res/layout/main_activity.xml # For handsets res/layout-sw600dp/main_activity.xml # For tablets. You need to have different layouts in the doc. Also check this link [this video]

Cites Raghunandan · 2013-04 · Stack Overflow · on “If i want to make an application compatible with tablet and mobile device”

You can create a single apk for both phones and tablet. Have a look at the link below [LINK] There's quote in the above link whcih says We encourage you to develop and publish a single APK that supports as many device configurations as possible, doing so is sometimes not possible So make a application that support as many devices as possible. Consider having multiple apk's only if required. [LINK] For example, the following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for medium, high, and extra high density screens. Design different layouts for different screen sizes res/layout/my_layout.

Cites android developer · 2013-11 · Stack Overflow · on “Dilemma: when to use Fragments vs Activities:”

Well, according to Google's lectures (maybe here [this video] , I don't remember) , you should consider using Fragments whenever it's possible, as it makes your code easier to maintain and control. However, I think that on some cases it can get too complex, as the activity that hosts the fragments need to navigate/communicate between them. I think you should decide by yourself what's best for you. It's usually not that hard to convert an activity to a fragment and vice versa. I've created a post about this dillema here [LINK] , if you wish to read some further.

Cites Hoang Nguyen · 2016-03 · Stack Overflow · on “Activity or Fragment with NavigationDrawer”

I think one activity that implements the NavigationDrawer and creates 4 fragments for the 4 modules. It's better! Activities are designed to represent a single screen of the application, while Fragments are designed to be reusable UI layouts with logic embedded inside of them. According to Google's lectures : Multi-Versioning Android User Interfaces [this video] . Fragments makes your code easier to maintain and control. what is the difference between Fragment and FragementActivity? You can see here: Difference between Fragment And FragmentActivity [LINK]