InterDash Blogs

Sharing experience

AdapterTransition

This project which is provided in the samples of the Android SDK seems like a great entry point for a developer trying to get familiar with the Android environment quickly. This write-up will cover importing a sample from the Android SDK in the Android Studio.

  1. Fragments
  2. ListView
  3. GridView
  4. Multiple layouts
  5. Multiple densities
  6. Logging
  7. Mock data
  8. Adapters
  9. Transitions

Installing the SDK examples

From the SDK Manager assure the SDK examples have been installed.

Once installed the files are typically in at

c:\Program Files (x86)\Android\android-studio\sdk\samples\android-19

The example we are looking for is AdapterTransition under the UI directory.

 

Copy the AdapterTransition directory to your projects directory (to preserve the source copy).

Establish a functional version

From the Android Studio ‘Import Project’

 

Navigate to the copy of AdapterTransition and select the build.gradle file and click OK.

 

Adding the missing strings

You will probably run into the following error. This is because there is no definition for ‘show_as_grid’, ‘show_as_list’, or ‘item_clicked’. The solution is to simply add those strings but the files may be read only so that must be addressed. I’ve captured the screens as they occurred to demonstrate the debugging process to get the project working.

Base on this error I can see @string/show_as_grid is missing.

Trying to add to the strings.xml file I ran into this. You can clear the ‘Read-Only’ status on each file as you make changes, or remove the ‘read-only’ attribute from the Windows File Explorer.


 

After adding a string it is important to ‘Save’ or ‘Rebuild’

After the Rebuild two more strings show up, ‘show_as_list’ and ‘item_clicked’.

One more rebuild and no errors. I can run up the example and see how it works.

 

 

Updated: June 5, 2014 — 11:00 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

InterDash Blogs © 2014 Frontier Theme