diff --git a/BroadcasrReceiverTutorial2/app/.gitignore b/BroadcasrReceiverTutorial2/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/BroadcasrReceiverTutorial2/app/app.iml b/BroadcasrReceiverTutorial2/app/app.iml
new file mode 100644
index 0000000..9724666
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/app.iml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BroadcasrReceiverTutorial2/app/build.gradle b/BroadcasrReceiverTutorial2/app/build.gradle
new file mode 100644
index 0000000..d215175
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ applicationId "de.vogella.android.alarm"
+ minSdkVersion 16
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.3'
+}
diff --git a/BroadcasrReceiverTutorial2/app/proguard-rules.pro b/BroadcasrReceiverTutorial2/app/proguard-rules.pro
new file mode 100644
index 0000000..142abec
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\winsxx\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/BroadcasrReceiverTutorial2/app/src/androidTest/java/de/vogella/android/alarm/ApplicationTest.java b/BroadcasrReceiverTutorial2/app/src/androidTest/java/de/vogella/android/alarm/ApplicationTest.java
new file mode 100644
index 0000000..1a990bb
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/androidTest/java/de/vogella/android/alarm/ApplicationTest.java
@@ -0,0 +1,13 @@
+package de.vogella.android.alarm;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/BroadcasrReceiverTutorial2/app/src/main/AndroidManifest.xml b/BroadcasrReceiverTutorial2/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..bc92a91
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/AndroidManifest.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BroadcasrReceiverTutorial2/app/src/main/java/de/vogella/android/alarm/AlarmActivity.java b/BroadcasrReceiverTutorial2/app/src/main/java/de/vogella/android/alarm/AlarmActivity.java
new file mode 100644
index 0000000..19e626a
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/java/de/vogella/android/alarm/AlarmActivity.java
@@ -0,0 +1,34 @@
+package de.vogella.android.alarm;
+
+import android.app.Activity;
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.Toast;
+
+public class AlarmActivity extends Activity {
+
+ /** Called when the activity is first created. */
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_alarm);
+ }
+
+ public void startAlert(View view) {
+ EditText text = (EditText) findViewById(R.id.time);
+ int i = Integer.parseInt(text.getText().toString());
+ Intent intent = new Intent(this, MyBroadcastReceiver.class);
+ PendingIntent pendingIntent = PendingIntent.getBroadcast(this.getApplicationContext(), 234324243, intent, 0);
+ AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE);
+ alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis()
+ + (i * 1000), pendingIntent);
+ Toast.makeText(this, "Alarm set in " + i + " seconds",
+ Toast.LENGTH_LONG).show();
+ }
+
+}
\ No newline at end of file
diff --git a/BroadcasrReceiverTutorial2/app/src/main/java/de/vogella/android/alarm/MyBroadcastReceiver.java b/BroadcasrReceiverTutorial2/app/src/main/java/de/vogella/android/alarm/MyBroadcastReceiver.java
new file mode 100644
index 0000000..501aaf7
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/java/de/vogella/android/alarm/MyBroadcastReceiver.java
@@ -0,0 +1,21 @@
+package de.vogella.android.alarm;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Vibrator;
+import android.widget.Toast;
+
+public class MyBroadcastReceiver extends BroadcastReceiver {
+ public MyBroadcastReceiver() {
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Toast.makeText(context, "Don't panic but your time is up!!!!.",
+ Toast.LENGTH_LONG).show();
+ // Vibrate the mobile phone
+ Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
+ vibrator.vibrate(2000);
+ }
+}
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/drawable-hdpi/ic_launcher.png b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
Binary files /dev/null and b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/drawable-mdpi/ic_launcher.png b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
Binary files /dev/null and b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/drawable-xhdpi/ic_launcher.png b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
Binary files /dev/null and b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4df1894
Binary files /dev/null and b/BroadcasrReceiverTutorial2/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/layout/activity_alarm.xml b/BroadcasrReceiverTutorial2/app/src/main/res/layout/activity_alarm.xml
new file mode 100644
index 0000000..145689d
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/res/layout/activity_alarm.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/menu/menu_alarm.xml b/BroadcasrReceiverTutorial2/app/src/main/res/menu/menu_alarm.xml
new file mode 100644
index 0000000..aed6bc4
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/res/menu/menu_alarm.xml
@@ -0,0 +1,6 @@
+
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/values-w820dp/dimens.xml b/BroadcasrReceiverTutorial2/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/values/dimens.xml b/BroadcasrReceiverTutorial2/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/values/strings.xml b/BroadcasrReceiverTutorial2/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..eb8be6d
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/res/values/strings.xml
@@ -0,0 +1,8 @@
+
+
+
+ Alarm Receiver
+ Hello world!
+ Settings
+
+
diff --git a/BroadcasrReceiverTutorial2/app/src/main/res/values/styles.xml b/BroadcasrReceiverTutorial2/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..766ab99
--- /dev/null
+++ b/BroadcasrReceiverTutorial2/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/BroadcastReceiverTutorial/app/.gitignore b/BroadcastReceiverTutorial/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/BroadcastReceiverTutorial/app/app.iml b/BroadcastReceiverTutorial/app/app.iml
new file mode 100644
index 0000000..9724666
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/app.iml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BroadcastReceiverTutorial/app/build.gradle b/BroadcastReceiverTutorial/app/build.gradle
new file mode 100644
index 0000000..542ad73
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ applicationId "de.vogella.android.receiver.phone"
+ minSdkVersion 16
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.3'
+}
diff --git a/BroadcastReceiverTutorial/app/proguard-rules.pro b/BroadcastReceiverTutorial/app/proguard-rules.pro
new file mode 100644
index 0000000..142abec
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\winsxx\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/BroadcastReceiverTutorial/app/src/androidTest/java/de/vogella/android/receiver/phone/ApplicationTest.java b/BroadcastReceiverTutorial/app/src/androidTest/java/de/vogella/android/receiver/phone/ApplicationTest.java
new file mode 100644
index 0000000..32cec34
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/androidTest/java/de/vogella/android/receiver/phone/ApplicationTest.java
@@ -0,0 +1,13 @@
+package de.vogella.android.receiver.phone;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/BroadcastReceiverTutorial/app/src/main/AndroidManifest.xml b/BroadcastReceiverTutorial/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..f25ec33
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/AndroidManifest.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BroadcastReceiverTutorial/app/src/main/java/de/vogella/android/receiver/phone/MainActivity.java b/BroadcastReceiverTutorial/app/src/main/java/de/vogella/android/receiver/phone/MainActivity.java
new file mode 100644
index 0000000..283b7e2
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/java/de/vogella/android/receiver/phone/MainActivity.java
@@ -0,0 +1,39 @@
+package de.vogella.android.receiver.phone;
+
+import android.support.v7.app.ActionBarActivity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+
+public class MainActivity extends ActionBarActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ }
+
+
+ @Override
+ public boolean onCreateOptionsMenu(Menu menu) {
+ // Inflate the menu; this adds items to the action bar if it is present.
+ getMenuInflater().inflate(R.menu.menu_main, menu);
+ return true;
+ }
+
+ @Override
+ public boolean onOptionsItemSelected(MenuItem item) {
+ // Handle action bar item clicks here. The action bar will
+ // automatically handle clicks on the Home/Up button, so long
+ // as you specify a parent activity in AndroidManifest.xml.
+ int id = item.getItemId();
+
+ //noinspection SimplifiableIfStatement
+ if (id == R.id.action_settings) {
+ return true;
+ }
+
+ return super.onOptionsItemSelected(item);
+ }
+}
diff --git a/BroadcastReceiverTutorial/app/src/main/java/de/vogella/android/receiver/phone/MyPhoneReceiver.java b/BroadcastReceiverTutorial/app/src/main/java/de/vogella/android/receiver/phone/MyPhoneReceiver.java
new file mode 100644
index 0000000..f81fa50
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/java/de/vogella/android/receiver/phone/MyPhoneReceiver.java
@@ -0,0 +1,28 @@
+package de.vogella.android.receiver.phone;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.telecom.TelecomManager;
+import android.telephony.TelephonyManager;
+import android.util.Log;
+
+public class MyPhoneReceiver extends BroadcastReceiver {
+ public MyPhoneReceiver() {
+ }
+
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Bundle extras = intent.getExtras();
+
+ if (extras != null) {
+ String state = extras.getString(TelephonyManager.EXTRA_STATE);
+ Log.w("MY_DEBUG_TAG", state);
+ if (state.equals(TelephonyManager.EXTRA_STATE_RINGING)) {
+ String phoneNumber = extras.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
+ Log.w("MY_DEBUG_TAG", phoneNumber);
+ }
+ }
+ }
+}
diff --git a/BroadcastReceiverTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png b/BroadcastReceiverTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
Binary files /dev/null and b/BroadcastReceiverTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/BroadcastReceiverTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png b/BroadcastReceiverTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
Binary files /dev/null and b/BroadcastReceiverTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/BroadcastReceiverTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png b/BroadcastReceiverTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
Binary files /dev/null and b/BroadcastReceiverTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/BroadcastReceiverTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/BroadcastReceiverTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4df1894
Binary files /dev/null and b/BroadcastReceiverTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/BroadcastReceiverTutorial/app/src/main/res/layout/activity_main.xml b/BroadcastReceiverTutorial/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..794e2bb
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/BroadcastReceiverTutorial/app/src/main/res/menu/menu_main.xml b/BroadcastReceiverTutorial/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..f979f13
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,10 @@
+
diff --git a/BroadcastReceiverTutorial/app/src/main/res/values-w820dp/dimens.xml b/BroadcastReceiverTutorial/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/BroadcastReceiverTutorial/app/src/main/res/values/dimens.xml b/BroadcastReceiverTutorial/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/BroadcastReceiverTutorial/app/src/main/res/values/strings.xml b/BroadcastReceiverTutorial/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..c1a613f
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/res/values/strings.xml
@@ -0,0 +1,9 @@
+
+
+
+ BroadcastReceiver Tutorial
+ MainActivity
+ Hello world!
+ Settings
+
+
diff --git a/BroadcastReceiverTutorial/app/src/main/res/values/styles.xml b/BroadcastReceiverTutorial/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..766ab99
--- /dev/null
+++ b/BroadcastReceiverTutorial/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/IntentTutorial/app/.gitignore b/IntentTutorial/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/IntentTutorial/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/IntentTutorial/app/app.iml b/IntentTutorial/app/app.iml
new file mode 100644
index 0000000..9724666
--- /dev/null
+++ b/IntentTutorial/app/app.iml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial/app/build.gradle b/IntentTutorial/app/build.gradle
new file mode 100644
index 0000000..beeff0b
--- /dev/null
+++ b/IntentTutorial/app/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ applicationId "com.vogella.android.intent.explicit"
+ minSdkVersion 16
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.3'
+}
diff --git a/IntentTutorial/app/proguard-rules.pro b/IntentTutorial/app/proguard-rules.pro
new file mode 100644
index 0000000..142abec
--- /dev/null
+++ b/IntentTutorial/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\winsxx\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/IntentTutorial/app/src/androidTest/java/com/vogella/android/intent/explicit/ApplicationTest.java b/IntentTutorial/app/src/androidTest/java/com/vogella/android/intent/explicit/ApplicationTest.java
new file mode 100644
index 0000000..057b189
--- /dev/null
+++ b/IntentTutorial/app/src/androidTest/java/com/vogella/android/intent/explicit/ApplicationTest.java
@@ -0,0 +1,13 @@
+package com.vogella.android.intent.explicit;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/IntentTutorial/app/src/main/AndroidManifest.xml b/IntentTutorial/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..3899e48
--- /dev/null
+++ b/IntentTutorial/app/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial/app/src/main/java/com/vogella/android/intent/explicit/MainActivity.java b/IntentTutorial/app/src/main/java/com/vogella/android/intent/explicit/MainActivity.java
new file mode 100644
index 0000000..a318ba8
--- /dev/null
+++ b/IntentTutorial/app/src/main/java/com/vogella/android/intent/explicit/MainActivity.java
@@ -0,0 +1,42 @@
+package com.vogella.android.intent.explicit;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+import android.widget.Toast;
+
+public class MainActivity extends Activity {
+
+ private static final int REQUEST_CODE = 10;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ }
+
+ public void onClick(View view) {
+ EditText text = (EditText) findViewById(R.id.inputforintent);
+ // used later
+ String value = text.getText().toString();
+
+ Intent intent = new Intent(this, ResultActivity.class);
+ intent.putExtra("mainText", value);
+
+ startActivityForResult(intent, REQUEST_CODE);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (resultCode == RESULT_OK && requestCode == REQUEST_CODE) {
+ if (data.hasExtra("returnString")) {
+ String result = data.getExtras().getString("returnString");
+ if (result != null && result.length() > 0) {
+ Toast.makeText(this, result, Toast.LENGTH_SHORT).show();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/IntentTutorial/app/src/main/java/com/vogella/android/intent/explicit/ResultActivity.java b/IntentTutorial/app/src/main/java/com/vogella/android/intent/explicit/ResultActivity.java
new file mode 100644
index 0000000..0fb8a75
--- /dev/null
+++ b/IntentTutorial/app/src/main/java/com/vogella/android/intent/explicit/ResultActivity.java
@@ -0,0 +1,37 @@
+package com.vogella.android.intent.explicit;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.widget.EditText;
+import android.widget.TextView;
+
+public class ResultActivity extends Activity {
+
+ @Override
+ public void onCreate(Bundle bundle) {
+ super.onCreate(bundle);
+ setContentView(R.layout.activity_result);
+
+ Bundle extras = getIntent().getExtras();
+ String toBeShownText = extras.getString("mainText");
+
+ TextView textView = (TextView) findViewById(R.id.displayintentextra);
+ textView.setText(toBeShownText);
+ }
+
+ @Override
+ public void finish() {
+
+ Intent intent = new Intent();
+
+ EditText et = (EditText) findViewById(R.id.returnValue);
+ String returnText = et.getText().toString();
+
+ intent.putExtra("returnString", returnText);
+
+ setResult(RESULT_OK, intent);
+
+ super.finish();
+ }
+}
\ No newline at end of file
diff --git a/IntentTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png b/IntentTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
Binary files /dev/null and b/IntentTutorial/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/IntentTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png b/IntentTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
Binary files /dev/null and b/IntentTutorial/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/IntentTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png b/IntentTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
Binary files /dev/null and b/IntentTutorial/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/IntentTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/IntentTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4df1894
Binary files /dev/null and b/IntentTutorial/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/IntentTutorial/app/src/main/res/layout/activity_main.xml b/IntentTutorial/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..e25f7b8
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial/app/src/main/res/layout/activity_result.xml b/IntentTutorial/app/src/main/res/layout/activity_result.xml
new file mode 100644
index 0000000..cdad323
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/layout/activity_result.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial/app/src/main/res/menu/menu_main.xml b/IntentTutorial/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..36428ec
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,10 @@
+
diff --git a/IntentTutorial/app/src/main/res/menu/menu_result.xml b/IntentTutorial/app/src/main/res/menu/menu_result.xml
new file mode 100644
index 0000000..a0cab2d
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/menu/menu_result.xml
@@ -0,0 +1,10 @@
+
diff --git a/IntentTutorial/app/src/main/res/values-w820dp/dimens.xml b/IntentTutorial/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/IntentTutorial/app/src/main/res/values/dimens.xml b/IntentTutorial/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/IntentTutorial/app/src/main/res/values/strings.xml b/IntentTutorial/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..eac406d
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/values/strings.xml
@@ -0,0 +1,9 @@
+
+
+
+ Intent Tutorial
+ Hello world!
+ Settings
+ ResultActivity
+
+
diff --git a/IntentTutorial/app/src/main/res/values/styles.xml b/IntentTutorial/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..766ab99
--- /dev/null
+++ b/IntentTutorial/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/IntentTutorial2/app/.gitignore b/IntentTutorial2/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/IntentTutorial2/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/IntentTutorial2/app/app.iml b/IntentTutorial2/app/app.iml
new file mode 100644
index 0000000..9724666
--- /dev/null
+++ b/IntentTutorial2/app/app.iml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial2/app/build.gradle b/IntentTutorial2/app/build.gradle
new file mode 100644
index 0000000..b8c11fc
--- /dev/null
+++ b/IntentTutorial2/app/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ applicationId "de.vogella.android.intent.browserfilter"
+ minSdkVersion 16
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.3'
+}
diff --git a/IntentTutorial2/app/proguard-rules.pro b/IntentTutorial2/app/proguard-rules.pro
new file mode 100644
index 0000000..142abec
--- /dev/null
+++ b/IntentTutorial2/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\winsxx\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/IntentTutorial2/app/src/androidTest/java/de/vogella/android/intent/browserfilter/ApplicationTest.java b/IntentTutorial2/app/src/androidTest/java/de/vogella/android/intent/browserfilter/ApplicationTest.java
new file mode 100644
index 0000000..143f2aa
--- /dev/null
+++ b/IntentTutorial2/app/src/androidTest/java/de/vogella/android/intent/browserfilter/ApplicationTest.java
@@ -0,0 +1,13 @@
+package de.vogella.android.intent.browserfilter;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/IntentTutorial2/app/src/main/AndroidManifest.xml b/IntentTutorial2/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..e66313d
--- /dev/null
+++ b/IntentTutorial2/app/src/main/AndroidManifest.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial2/app/src/main/java/de/vogella/android/intent/browserfilter/BrowserActivity.java b/IntentTutorial2/app/src/main/java/de/vogella/android/intent/browserfilter/BrowserActivity.java
new file mode 100644
index 0000000..663cdc4
--- /dev/null
+++ b/IntentTutorial2/app/src/main/java/de/vogella/android/intent/browserfilter/BrowserActivity.java
@@ -0,0 +1,48 @@
+package de.vogella.android.intent.browserfilter;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.StrictMode;
+import android.widget.TextView;
+
+public class BrowserActivity extends Activity {
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
+ .permitAll().build();
+ StrictMode.setThreadPolicy(policy);
+
+ setContentView(R.layout.activity_browser);
+ Intent intent = getIntent();
+ TextView text = (TextView) findViewById(R.id.textView);
+
+ String action = intent.getAction();
+ if (!action.equals(Intent.ACTION_VIEW)) {
+ throw new RuntimeException("Should not happen");
+ }
+
+ Uri data = intent.getData();
+ URL url;
+ try {
+ url = new URL(data.getScheme(), data.getHost(), data.getPath());
+ BufferedReader rd = new BufferedReader(new InputStreamReader(url.openStream()));
+ String line = "";
+ while ((line = rd.readLine()) != null) {
+ text.append(line);
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+}
+
diff --git a/IntentTutorial2/app/src/main/res/drawable-hdpi/ic_launcher.png b/IntentTutorial2/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
Binary files /dev/null and b/IntentTutorial2/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/IntentTutorial2/app/src/main/res/drawable-mdpi/ic_launcher.png b/IntentTutorial2/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
Binary files /dev/null and b/IntentTutorial2/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/IntentTutorial2/app/src/main/res/drawable-xhdpi/ic_launcher.png b/IntentTutorial2/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
Binary files /dev/null and b/IntentTutorial2/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/IntentTutorial2/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/IntentTutorial2/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4df1894
Binary files /dev/null and b/IntentTutorial2/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/IntentTutorial2/app/src/main/res/layout/activity_browser.xml b/IntentTutorial2/app/src/main/res/layout/activity_browser.xml
new file mode 100644
index 0000000..2d4aeb7
--- /dev/null
+++ b/IntentTutorial2/app/src/main/res/layout/activity_browser.xml
@@ -0,0 +1,11 @@
+
+
+
+
\ No newline at end of file
diff --git a/IntentTutorial2/app/src/main/res/menu/menu_browser.xml b/IntentTutorial2/app/src/main/res/menu/menu_browser.xml
new file mode 100644
index 0000000..a4985e7
--- /dev/null
+++ b/IntentTutorial2/app/src/main/res/menu/menu_browser.xml
@@ -0,0 +1,7 @@
+
diff --git a/IntentTutorial2/app/src/main/res/values-w820dp/dimens.xml b/IntentTutorial2/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/IntentTutorial2/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/IntentTutorial2/app/src/main/res/values/dimens.xml b/IntentTutorial2/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/IntentTutorial2/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/IntentTutorial2/app/src/main/res/values/strings.xml b/IntentTutorial2/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..d7e8d5c
--- /dev/null
+++ b/IntentTutorial2/app/src/main/res/values/strings.xml
@@ -0,0 +1,9 @@
+
+
+
+ Browser
+ BrowserActivity
+ Hello world!
+ Settings
+
+
diff --git a/IntentTutorial2/app/src/main/res/values/styles.xml b/IntentTutorial2/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..766ab99
--- /dev/null
+++ b/IntentTutorial2/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/IntentTutorial3/IntentTutorial3.iml b/IntentTutorial3/IntentTutorial3.iml
new file mode 100644
index 0000000..2a02201
--- /dev/null
+++ b/IntentTutorial3/IntentTutorial3.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial3/app/app.iml b/IntentTutorial3/app/app.iml
new file mode 100644
index 0000000..9724666
--- /dev/null
+++ b/IntentTutorial3/app/app.iml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial3/app/src/main/java/de/vogella/android/imagepick/MainActivity.java b/IntentTutorial3/app/src/main/java/de/vogella/android/imagepick/MainActivity.java
new file mode 100644
index 0000000..a85b728
--- /dev/null
+++ b/IntentTutorial3/app/src/main/java/de/vogella/android/imagepick/MainActivity.java
@@ -0,0 +1,64 @@
+package de.vogella.android.imagepick;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ImageView;
+
+
+public class MainActivity extends Activity {
+ private static final int REQUEST_CODE = 1;
+ private Bitmap bitmap;
+ private ImageView imageView;
+
+
+ /** Called when the activity is first created. */
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ imageView = (ImageView) findViewById(R.id.result);
+ }
+
+ public void pickImage(View View) {
+ Intent intent = new Intent();
+ intent.setType("image/*");
+ intent.setAction(Intent.ACTION_GET_CONTENT);
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
+ startActivityForResult(intent, REQUEST_CODE);
+ }
+
+ @Override
+ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+ InputStream stream = null;
+ if (requestCode == REQUEST_CODE && resultCode == Activity.RESULT_OK)
+ try {
+ // recyle unused bitmaps
+ if (bitmap != null) {
+ bitmap.recycle();
+ }
+ stream = getContentResolver().openInputStream(data.getData());
+ bitmap = BitmapFactory.decodeStream(stream);
+
+ imageView.setImageBitmap(bitmap);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ } finally {
+ if (stream != null)
+ try {
+ stream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+}
+
diff --git a/IntentTutorial4/app/.gitignore b/IntentTutorial4/app/.gitignore
new file mode 100644
index 0000000..796b96d
--- /dev/null
+++ b/IntentTutorial4/app/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/IntentTutorial4/app/app.iml b/IntentTutorial4/app/app.iml
new file mode 100644
index 0000000..9724666
--- /dev/null
+++ b/IntentTutorial4/app/app.iml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial4/app/build.gradle b/IntentTutorial4/app/build.gradle
new file mode 100644
index 0000000..d7c5741
--- /dev/null
+++ b/IntentTutorial4/app/build.gradle
@@ -0,0 +1,25 @@
+apply plugin: 'com.android.application'
+
+android {
+ compileSdkVersion 21
+ buildToolsVersion "21.1.2"
+
+ defaultConfig {
+ applicationId "de.vogella.android.intent.implicit"
+ minSdkVersion 16
+ targetSdkVersion 21
+ versionCode 1
+ versionName "1.0"
+ }
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ }
+ }
+}
+
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ compile 'com.android.support:appcompat-v7:21.0.3'
+}
diff --git a/IntentTutorial4/app/proguard-rules.pro b/IntentTutorial4/app/proguard-rules.pro
new file mode 100644
index 0000000..142abec
--- /dev/null
+++ b/IntentTutorial4/app/proguard-rules.pro
@@ -0,0 +1,17 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\winsxx\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/IntentTutorial4/app/src/androidTest/java/de/vogella/android/intent/implicit/ApplicationTest.java b/IntentTutorial4/app/src/androidTest/java/de/vogella/android/intent/implicit/ApplicationTest.java
new file mode 100644
index 0000000..334609e
--- /dev/null
+++ b/IntentTutorial4/app/src/androidTest/java/de/vogella/android/intent/implicit/ApplicationTest.java
@@ -0,0 +1,13 @@
+package de.vogella.android.intent.implicit;
+
+import android.app.Application;
+import android.test.ApplicationTestCase;
+
+/**
+ * Testing Fundamentals
+ */
+public class ApplicationTest extends ApplicationTestCase {
+ public ApplicationTest() {
+ super(Application.class);
+ }
+}
\ No newline at end of file
diff --git a/IntentTutorial4/app/src/main/AndroidManifest.xml b/IntentTutorial4/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..7f0607e
--- /dev/null
+++ b/IntentTutorial4/app/src/main/AndroidManifest.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/IntentTutorial4/app/src/main/java/de/vogella/android/intent/implicit/CallIntentsActivity.java b/IntentTutorial4/app/src/main/java/de/vogella/android/intent/implicit/CallIntentsActivity.java
new file mode 100644
index 0000000..73cb669
--- /dev/null
+++ b/IntentTutorial4/app/src/main/java/de/vogella/android/intent/implicit/CallIntentsActivity.java
@@ -0,0 +1,81 @@
+package de.vogella.android.intent.implicit;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+import android.widget.Toast;
+
+public class CallIntentsActivity extends Activity {
+ private Spinner spinner;
+
+
+ /** Called when the activity is first created. */
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_call_intents);
+ spinner = (Spinner) findViewById(R.id.spinner);
+ ArrayAdapter adapter = ArrayAdapter.createFromResource(this,
+ R.array.intents, android.R.layout.simple_spinner_item);
+ adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+ spinner.setAdapter(adapter);
+ }
+
+ public void onClick(View view) {
+ int position = spinner.getSelectedItemPosition();
+ Intent intent = null;
+ switch (position) {
+ case 0:
+ intent = new Intent(Intent.ACTION_VIEW,
+ Uri.parse("http://www.vogella.com"));
+ break;
+ case 1:
+ intent = new Intent(Intent.ACTION_CALL,
+ Uri.parse("tel:(+49)12345789"));
+ break;
+ case 2:
+ intent = new Intent(Intent.ACTION_DIAL,
+ Uri.parse("tel:(+49)12345789"));
+ startActivity(intent);
+ break;
+ case 3:
+ intent = new Intent(Intent.ACTION_VIEW,
+ Uri.parse("geo:50.123,7.1434?z=19"));
+ break;
+ case 4:
+ intent = new Intent(Intent.ACTION_VIEW,
+ Uri.parse("geo:0,0?q=query"));
+ break;
+ case 5:
+ intent = new Intent("android.media.action.IMAGE_CAPTURE");
+ break;
+ case 6:
+ intent = new Intent(Intent.ACTION_VIEW,
+ Uri.parse("content://contacts/people/"));
+ break;
+ case 7:
+ intent = new Intent(Intent.ACTION_EDIT,
+ Uri.parse("content://contacts/people/1"));
+ break;
+
+ }
+ if (intent != null) {
+ startActivity(intent);
+ }
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (resultCode == Activity.RESULT_OK && requestCode == 0) {
+ String result = data.toURI();
+ Toast.makeText(this, result, Toast.LENGTH_LONG);
+ }
+ }
+
+}
+
diff --git a/IntentTutorial4/app/src/main/res/drawable-hdpi/ic_launcher.png b/IntentTutorial4/app/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..96a442e
Binary files /dev/null and b/IntentTutorial4/app/src/main/res/drawable-hdpi/ic_launcher.png differ
diff --git a/IntentTutorial4/app/src/main/res/drawable-mdpi/ic_launcher.png b/IntentTutorial4/app/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..359047d
Binary files /dev/null and b/IntentTutorial4/app/src/main/res/drawable-mdpi/ic_launcher.png differ
diff --git a/IntentTutorial4/app/src/main/res/drawable-xhdpi/ic_launcher.png b/IntentTutorial4/app/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..71c6d76
Binary files /dev/null and b/IntentTutorial4/app/src/main/res/drawable-xhdpi/ic_launcher.png differ
diff --git a/IntentTutorial4/app/src/main/res/drawable-xxhdpi/ic_launcher.png b/IntentTutorial4/app/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..4df1894
Binary files /dev/null and b/IntentTutorial4/app/src/main/res/drawable-xxhdpi/ic_launcher.png differ
diff --git a/IntentTutorial4/app/src/main/res/layout/activity_call_intents.xml b/IntentTutorial4/app/src/main/res/layout/activity_call_intents.xml
new file mode 100644
index 0000000..245d8c5
--- /dev/null
+++ b/IntentTutorial4/app/src/main/res/layout/activity_call_intents.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/IntentTutorial4/app/src/main/res/menu/menu_call_intents.xml b/IntentTutorial4/app/src/main/res/menu/menu_call_intents.xml
new file mode 100644
index 0000000..8e515e1
--- /dev/null
+++ b/IntentTutorial4/app/src/main/res/menu/menu_call_intents.xml
@@ -0,0 +1,6 @@
+
diff --git a/IntentTutorial4/app/src/main/res/values-w820dp/dimens.xml b/IntentTutorial4/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/IntentTutorial4/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/IntentTutorial4/app/src/main/res/values/dimens.xml b/IntentTutorial4/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/IntentTutorial4/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+
diff --git a/IntentTutorial4/app/src/main/res/values/strings.xml b/IntentTutorial4/app/src/main/res/values/strings.xml
new file mode 100644
index 0000000..199bf6d
--- /dev/null
+++ b/IntentTutorial4/app/src/main/res/values/strings.xml
@@ -0,0 +1,17 @@
+
+
+
+ Implicit Intent
+ Hello world!
+ Settings
+
+ - Open Browser
+ - Call Someone
+ - Dial
+ - Show Map
+ - Search on Map
+ - Take picture
+ - Show contacts
+ - Edit first contact
+
+
diff --git a/IntentTutorial4/app/src/main/res/values/styles.xml b/IntentTutorial4/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..766ab99
--- /dev/null
+++ b/IntentTutorial4/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
diff --git a/LifeCycleTutorial/LifeCycleTutorial.iml b/LifeCycleTutorial/LifeCycleTutorial.iml
new file mode 100644
index 0000000..2a02201
--- /dev/null
+++ b/LifeCycleTutorial/LifeCycleTutorial.iml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LifeCycleTutorial/app/app.iml b/LifeCycleTutorial/app/app.iml
new file mode 100644
index 0000000..9724666
--- /dev/null
+++ b/LifeCycleTutorial/app/app.iml
@@ -0,0 +1,91 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/MainActivity.java b/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/MainActivity.java
new file mode 100644
index 0000000..a4ef20f
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/MainActivity.java
@@ -0,0 +1,29 @@
+package com.vogella.android.lifecycle.activity;
+
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+
+public class MainActivity extends TracerActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ // configure the spinner in code
+ Spinner spinner = (Spinner) findViewById(R.id.spinner);
+ String[] values = getResources().getStringArray(R.array.operating_systems);
+ ArrayAdapter adapter =
+ new ArrayAdapter(this, android.R.layout.simple_list_item_1, values);
+ spinner.setAdapter(adapter);
+ }
+
+ public void onClick(View view) {
+ Intent intent = new Intent(this, SecondActivity.class);
+ startActivity(intent);
+ }
+
+}
\ No newline at end of file
diff --git a/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/SecondActivity.java b/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/SecondActivity.java
new file mode 100644
index 0000000..c2a759b
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/SecondActivity.java
@@ -0,0 +1,13 @@
+package com.vogella.android.lifecycle.activity;
+
+import android.os.Bundle;
+
+public class SecondActivity extends TracerActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_second);
+ }
+
+}
diff --git a/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/TracerActivity.java b/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/TracerActivity.java
new file mode 100644
index 0000000..dcf11d8
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/java/com/vogella/android/lifecycle/activity/TracerActivity.java
@@ -0,0 +1,65 @@
+package com.vogella.android.lifecycle.activity;
+
+import android.app.Activity;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.os.Bundle;
+
+public class TracerActivity extends Activity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ notify("onCreate");
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ notify("onPause");
+ }
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ notify("onResume");
+ }
+
+ @Override
+ protected void onStop() {
+ super.onStop();
+ notify("onStop");
+ }
+
+ @Override
+ protected void onDestroy() {
+ super.onDestroy();
+ notify("onDestroy");
+ }
+
+ @Override
+ protected void onRestoreInstanceState(Bundle savedInstanceState) {
+ super.onRestoreInstanceState(savedInstanceState);
+ notify("onRestoreInstanceState");
+ }
+
+ @Override
+ protected void onSaveInstanceState(Bundle outState) {
+ super.onSaveInstanceState(outState);
+ notify("onSaveInstanceState");
+ }
+
+ private void notify(String methodName) {
+ String name = this.getClass().getName();
+ String[] strings = name.split("\\.");
+ Notification noti = new Notification.Builder(this)
+ .setContentTitle(methodName + " " + strings[strings.length - 1]).setAutoCancel(true)
+ .setSmallIcon(R.drawable.ic_launcher)
+ .setContentText(name).build();
+ NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+ notificationManager.notify((int) System.currentTimeMillis(), noti);
+ }
+
+}
+
+
diff --git a/LifeCycleTutorial/app/src/main/res/layout/activity_main.xml b/LifeCycleTutorial/app/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..cc75799
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/layout/activity_main.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/LifeCycleTutorial/app/src/main/res/layout/activity_second.xml b/LifeCycleTutorial/app/src/main/res/layout/activity_second.xml
new file mode 100644
index 0000000..d2db1f5
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/layout/activity_second.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
diff --git a/LifeCycleTutorial/app/src/main/res/layout/activity_tracer.xml b/LifeCycleTutorial/app/src/main/res/layout/activity_tracer.xml
new file mode 100644
index 0000000..888fff8
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/layout/activity_tracer.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/LifeCycleTutorial/app/src/main/res/menu/menu_main.xml b/LifeCycleTutorial/app/src/main/res/menu/menu_main.xml
new file mode 100644
index 0000000..e1dc21c
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/menu/menu_main.xml
@@ -0,0 +1,10 @@
+
diff --git a/LifeCycleTutorial/app/src/main/res/menu/menu_second.xml b/LifeCycleTutorial/app/src/main/res/menu/menu_second.xml
new file mode 100644
index 0000000..d1e0447
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/menu/menu_second.xml
@@ -0,0 +1,10 @@
+
diff --git a/LifeCycleTutorial/app/src/main/res/menu/menu_tracer.xml b/LifeCycleTutorial/app/src/main/res/menu/menu_tracer.xml
new file mode 100644
index 0000000..bc64bcf
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/menu/menu_tracer.xml
@@ -0,0 +1,10 @@
+
diff --git a/LifeCycleTutorial/app/src/main/res/values-w820dp/dimens.xml b/LifeCycleTutorial/app/src/main/res/values-w820dp/dimens.xml
new file mode 100644
index 0000000..63fc816
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/values-w820dp/dimens.xml
@@ -0,0 +1,6 @@
+
+
+ 64dp
+
diff --git a/LifeCycleTutorial/app/src/main/res/values/dimens.xml b/LifeCycleTutorial/app/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..47c8224
--- /dev/null
+++ b/LifeCycleTutorial/app/src/main/res/values/dimens.xml
@@ -0,0 +1,5 @@
+
+
+ 16dp
+ 16dp
+