Saturday, 27 September 2014

References in Java for Android



Coming from Web development background, I need some help understanding some of the basic syntax used in Android Applications' Java development aspects:


Context for these questions is the Development Training in development.android.com


1) How do the values "@string" , "@style" , "@drawable" reference to a directory on the project without explicitly given the exact path and exact folder name (drawable-hdpi/mdpi/xhdpi folders etc , strings.xml and styles.xml ) ?


2) According to the tutorial when I want to give a new ID resource definition I use "@+id/_" for that, is the action done behind the scene to add this as a temporary resource to the collection of id's used during runtime? would it be the same for a string or a style for example: "@+string/"? I'm asking because I know that the "@string/_" references to the "strings.xml" file but there is no "id.xml" file for id resources.


3) For the action bar the tutorial calls to use the themes directory from the Android Support class now I'm not sure how to call for them, mostly because they're in different Project files (the Android Support class is in appcompat_v7) and the tutorial just says to use "@style/Theme.AppCompat" when I don't have a resource called "Theme.AppCompact" in my "styles.xml" resource file.


Really frustraiting for me... would appreciate help on these!


No comments:

Post a Comment