├── settings.gradle ├── .gradle └── 2.10 │ ├── taskArtifacts │ ├── cache.properties │ ├── fileHashes.bin │ ├── fileSnapshots.bin │ ├── taskArtifacts.bin │ ├── outputFileStates.bin │ └── cache.properties.lock │ └── tasks │ ├── _app_compileDebugJavaWithJavac │ ├── localClassSetAnalysis │ │ ├── localClassSetAnalysis.bin │ │ └── localClassSetAnalysis.lock │ └── localJarClasspathSnapshot │ │ ├── localJarClasspathSnapshot.bin │ │ └── localJarClasspathSnapshot.lock │ └── _app_compileDebugAndroidTestJavaWithJavac │ ├── localClassSetAnalysis │ ├── localClassSetAnalysis.bin │ └── localClassSetAnalysis.lock │ └── localJarClasspathSnapshot │ ├── localJarClasspathSnapshot.bin │ └── localJarClasspathSnapshot.lock ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── app ├── src │ ├── main │ │ ├── res │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ └── layout │ │ │ │ ├── activity_second.xml │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── android │ │ │ └── twoactivities │ │ │ ├── SecondActivity.java │ │ │ └── MainActivity.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── example │ │ └── android │ │ └── twoactivities │ │ └── ActivityInputOutputTest.java ├── proguard-rules.pro ├── build.gradle └── app.iml ├── local.properties ├── gradle.properties ├── TwoActivities.iml ├── README.md ├── gradlew.bat └── gradlew /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':app' 2 | -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 05 08:36:07 IST 2017 2 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/outputFileStates.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/taskArtifacts/outputFileStates.bin -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gradle/2.10/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.bin -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localClassSetAnalysis/localClassSetAnalysis.lock -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Apr 11 11:01:21 PDT 2016 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip 7 | -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.bin -------------------------------------------------------------------------------- /.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lingarajsankaravelu/TwoActivitiesEspresso/master/.gradle/2.10/tasks/_app_compileDebugAndroidTestJavaWithJavac/localJarClasspathSnapshot/localJarClasspathSnapshot.lock -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Sun Nov 05 08:32:48 IST 2017 11 | sdk.dir=/Users/lingaraj/Library/Android/sdk 12 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/llemay/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 16dp 17 | 16dp 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 16 | #3F51B5 17 | #303F9F 18 | #FF4081 19 | 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /TwoActivities.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | 17 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.example.android.twoactivities" 9 | minSdkVersion 15 10 | targetSdkVersion 24 11 | versionCode 1 12 | versionName "1.0" 13 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | testCompile 'junit:junit:4.12' 26 | androidTestCompile ('com.android.support.test.espresso:espresso-core:2.2.2', { 27 | exclude group: 'com.android.support', module: 'support-annotations' 28 | }) 29 | compile 'com.android.support:appcompat-v7:24.1.0' 30 | androidTestCompile 'com.android.support:support-annotations:24.1.0' 31 | androidTestCompile 'com.android.support.test:runner:0.3' 32 | androidTestCompile 'com.android.support.test:rules:0.3' 33 | } 34 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | TwoActivities Sample App (Solution Code) 2 | ============ 3 | 4 | The TwoActivities app contains two activities. It uses an explicit intent 5 | to launch one activity from another, and uses intent extras to pass data between them. 6 | 7 | Pre-requisites 8 | -------------- 9 | 10 | For this app you should be familiar with: 11 | * Creating and running apps in Android Studio. 12 | 13 | Getting Started 14 | --------------- 15 | 16 | 1. Download and open the app in Android Studio. 17 | 18 | License 19 | ------- 20 | 21 | Copyright 2016 Google, Inc. 22 | 23 | Licensed to the Apache Software Foundation (ASF) under one or more contributor 24 | license agreements. See the NOTICE file distributed with this work for 25 | additional information regarding copyright ownership. The ASF licenses this 26 | file to you under the Apache License, Version 2.0 (the "License"); you may not 27 | use this file except in compliance with the License. You may obtain a copy of 28 | the License at 29 | 30 | http://www.apache.org/licenses/LICENSE-2.0 31 | 32 | Unless required by applicable law or agreed to in writing, software 33 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 34 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 35 | License for the specific language governing permissions and limitations under 36 | the License. 37 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 14 | 15 | 16 | Two Activities 17 | 18 | 19 | Second Activity 20 | 21 | 22 | Message Received 23 | 24 | 25 | Send 26 | 27 | 28 | Enter Your Message Here 29 | 30 | 31 | Reply 32 | 33 | 34 | Enter Your Reply Here 35 | 36 | 37 | Reply Received 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 34 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/example/android/twoactivities/ActivityInputOutputTest.java: -------------------------------------------------------------------------------- 1 | package com.example.android.twoactivities; 2 | 3 | import android.support.test.rule.ActivityTestRule; 4 | import android.support.test.runner.AndroidJUnit4; 5 | 6 | import org.junit.Rule; 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static android.support.test.espresso.Espresso.onView; 11 | import static android.support.test.espresso.action.ViewActions.click; 12 | import static android.support.test.espresso.action.ViewActions.typeText; 13 | import static android.support.test.espresso.assertion.ViewAssertions.matches; 14 | import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; 15 | import static android.support.test.espresso.matcher.ViewMatchers.withId; 16 | import static android.support.test.espresso.matcher.ViewMatchers.withText; 17 | 18 | /** 19 | * Created by lingaraj on 11/5/17. 20 | */ 21 | 22 | @RunWith(AndroidJUnit4.class) 23 | public class ActivityInputOutputTest { 24 | @Rule 25 | public ActivityTestRule mActivityRule = new ActivityTestRule<>(MainActivity.class); 26 | 27 | 28 | //@Test 29 | public void activityLaunch(){ 30 | onView(withId(R.id.button_main)).perform(click()); 31 | onView(withId(R.id.text_header)).check(matches(isDisplayed())); 32 | onView(withId(R.id.button_second)).perform(click()); 33 | onView(withId(R.id.text_header_reply)).check(matches(isDisplayed())); 34 | 35 | } 36 | 37 | @Test 38 | public void testEditTextInputOutput(){ 39 | String text_one ="Hai man how are you"; 40 | String text_reply = "Good, how is your life going bro"; 41 | onView(withId(R.id.editText_main)).perform(typeText(text_one)); 42 | onView(withId(R.id.button_main)).perform(click()); 43 | onView(withId(R.id.text_message)).check(matches(withText(text_one))); 44 | onView(withId(R.id.editText_second)).perform(typeText(text_reply)); 45 | onView(withId(R.id.button_second)).perform(click()); 46 | onView(withId(R.id.text_message_reply)).check(matches(withText(text_reply))); 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | 24 | 25 | 33 | 34 | 35 | 43 | 44 |