Skip to content

Commit

Permalink
Android Tutorial #4 - Layouts & Resources
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaeltoledo committed Jan 13, 2017
1 parent 8d6134a commit c436afa
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
@@ -1,21 +1,14 @@
package net.rafaeltoledo.tutorial;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
Log.d("MA::Action", intent.getAction());
for (String category : intent.getCategories()) {
Log.d("MA::Category", category);
}
Log.d("MA::Component", intent.getComponent().getClassName());
setContentView(R.layout.activity_main);
}
}
25 changes: 25 additions & 0 deletions app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:orientation="vertical">

<EditText
android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/name" />

<EditText
android:id="@+id/address"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/address" />

<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/save" />

</LinearLayout>
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
@@ -1,3 +1,6 @@
<resources>
<string name="app_name">Tutorial</string>
<string name="save">Save</string>
<string name="address">Address</string>
<string name="name">Name</string>
</resources>
2 changes: 1 addition & 1 deletion build.gradle
Expand Up @@ -5,7 +5,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-beta1'
classpath 'com.android.tools.build:gradle:2.3.0-beta2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Jan 09 21:18:07 BRST 2017
#Thu Jan 12 00:03:20 BRST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip

0 comments on commit c436afa

Please sign in to comment.