Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 31
buildToolsVersion "30.0.1"
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.example.simpleparadox.listycity"
minSdkVersion 15
targetSdkVersion 31
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -21,7 +21,6 @@ android {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}

packagingOptions {
exclude 'META-INF/LICENSE.md'
exclude 'META-INF/DEPENDENCIES'
Expand All @@ -40,10 +39,12 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

androidTestImplementation 'com.jayway.android.robotium:robotium-solo:5.3.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ public void checkCiyListItem(){
assertEquals("Edmonton", city);
}

/**
* switching between activities
*/
@Test
public void switchactivities(){
solo.clickOnButton("Show Activity");
solo.clickOnButton("Main Activity");
}

/**
* Close activity after each test
* @throws Exception
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".ShowActivity"
android:exported="false" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseBooleanArray;
Expand Down Expand Up @@ -71,6 +72,14 @@ public void onClick(View v) {
}
});

final Button showact = findViewById(R.id.gotoshowactivity);
showact.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, ShowActivity.class);
startActivity(intent);
}
});

}


Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.example.simpleparadox.listycity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class ShowActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show);

final Button mainact = findViewById(R.id.gotomainactivity);
mainact.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(ShowActivity.this, MainActivity.class);
startActivity(intent);
}
});
}
}
17 changes: 14 additions & 3 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity">
tools:context=".MainActivity"
android:layout_margin="10dp">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/button_add"
android:layout_width="180dp"
Expand All @@ -23,6 +27,13 @@
android:layout_width="180dp"
android:layout_height="wrap_content"
android:text="ClEAR ALL" />
</LinearLayout>

<Button
android:id="@+id/gotoshowactivity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Show Activity" />
</LinearLayout>

<ListView
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/res/layout/activity_show.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ShowActivity">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gotomainactivity"
android:text="Main Activity"></Button>

</LinearLayout>