Skip to content

Commit

Permalink
Bug-Fix: App crashing at Add Hotel [HS, HM, PJ]
Browse files Browse the repository at this point in the history
  • Loading branch information
Geoetrev committed Jun 3, 2020
1 parent a18a731 commit e283daf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@
android:name=".HotelDetailActivity"
android:label="@string/app_name"
android:parentActivityName=".MainActivity"
android:theme="@style/AppTheme.NoActionBar"> <!-- todo change MainActivity to ListAcitvity -->
android:theme="@style/AppTheme.NoActionBar">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.asd.hotels.MainActivity" /> <!-- todo change MainActivity to ListAcitvity -->
android:value="com.example.asd.hotels.MainActivity" />
</activity>
<activity android:name=".InsertHotelActivity"
android:label="@string/app_name">

<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.asd.hotels.MainActivity" />
</activity>
<uses-library
android:name="android.test.runner"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/example/asd/hotels/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ class MainActivity : AppCompatActivity() {
true
}
R.id.add_hotel -> {
val insertHotel = Intent(this.applicationContext, InsertHotelActivity::class.java)
this.applicationContext.startActivity(insertHotel)
val insertHotel = Intent(this@MainActivity, InsertHotelActivity::class.java)
this@MainActivity.startActivity(insertHotel)
true
}
else -> super.onOptionsItemSelected(item)
Expand Down

0 comments on commit e283daf

Please sign in to comment.