Skip to content

Commit

Permalink
P2022 177/navigate to details screen (#13)
Browse files Browse the repository at this point in the history
* Adds navigation to DetailsActivity from MainActivity using temporary image icon in header.

* Adds DetailsActivity to the manifest as it was missing.
  • Loading branch information
Lucas-Fresko authored Feb 22, 2022
1 parent 421ec61 commit 5548e83
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 4 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
android:name=".MainActivity"
android:exported="true" >
</activity>
<activity
android:name=".DetailsActivity"
android:exported="true" >
</activity>
</application>

</manifest>
12 changes: 11 additions & 1 deletion app/src/main/java/com/intive/patronage22/intivi/MainActivity.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package com.intive.patronage22.intivi

import androidx.appcompat.app.AppCompatActivity
import android.content.Intent
import android.os.Bundle
import android.view.View
import android.widget.ImageView
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
clickNavigate(findViewById<ImageView>(R.id.imageView), DetailsActivity::class.java)
}

private fun clickNavigate(view: View, activity: Class<*>){
view.setOnClickListener{
startActivity(Intent(this, activity))
}
}
}

0 comments on commit 5548e83

Please sign in to comment.