Android – Part 1

Full Source:

Android Studio uses Gradle to compile and build your app. This is where your app’s build dependencies are set, including the defaultConfig settings.

hyper-v and android emulators

gradlew.bat assbeleDebug

The at sign (@) is required when you’re referring to any resource object from XML. It is followed by the resource type (id in this case), a slash, then the resource name (edit_message)

By default, your Android project includes a string resource file at res > values > strings.xml. Here, you’ll add two new strings.

Make the Input Box Fill in the Screen Width
In activity_main.xml, modify the <EditText> so that the attributes look like this:

An Intent is an object that provides runtime binding between separate components (such as two activities). The Intent represents an app’s “intent to do something.” You can use intents for a wide variety of tasks.

Every Activity is invoked by an Intent, regardless of how the user navigated there.

To add support for more languages, create additional values directories inside res/ that include a hyphen and the ISO language code at the end of the directory name. For example, values-es/ is the directory containing simple resources for the Locales with the language code “es”.

In your source code, you can refer to a string resource with the syntax R.string.<string_name>. There are a variety of methods that accept a string resource this way.

Avoid specifying dimensions with px units, since they do not scale with screen density. Instead, specify dimensions with density-independent pixel (dp) units.

To create a dynamic and multi-pane user interface on Android, you need to encapsulate UI components and activity behaviors into modules that you can swap into and out of your activities. You can create these modules with the Fragment class, which behaves somewhat like a nested activity that can define its own layout and manage its own lifecycle.

Just like an activity, a fragment should implement other lifecycle callbacks that allow you to manage its state as it is added or removed from the activity and as the activity transitions between its lifecycle states. For instance, when the activity’s onPause() method is called, any fragments in the activity also receive a call to onPause().

Here is an example layout file that adds two fragments to an activity when the device screen is considered “large” (specified by the large qualifier in the directory name).

When you add a fragment to an activity layout by defining the fragment in the layout XML file, you cannot remove the fragment at runtime. If you plan to swap your fragments in and out during user interaction, you must add the fragment to the activity when the activity first starts, as shown in the next lesson.