forked from udacity/ud851-Sunshine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
mlustig
authored and
Jeremy Silver
committed
Jan 19, 2017
1 parent
caf6e7e
commit f294188
Showing
3 changed files
with
26 additions
and
3 deletions.
There are no files selected for viewing
17 changes: 16 additions & 1 deletion
17
app/src/main/java/com/example/android/sunshine/DetailActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
package com.example.android.sunshine; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.widget.TextView; | ||
|
||
public class DetailActivity extends AppCompatActivity { | ||
|
||
private static final String FORECAST_SHARE_HASHTAG = " #SunshineApp"; | ||
|
||
private String mForecast; | ||
private TextView mWeatherDisplay; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_detail); | ||
|
||
// TODO (2) Display the weather forecast that was passed from MainActivity | ||
mWeatherDisplay = (TextView) findViewById(R.id.tv_display_weather); | ||
|
||
Intent intentThatStartedThisActivity = getIntent(); | ||
|
||
// COMPLETED (2) Display the weather forecast that was passed from MainActivity | ||
if (intentThatStartedThisActivity != null) { | ||
if (intentThatStartedThisActivity.hasExtra(Intent.EXTRA_TEXT)) { | ||
mForecast = intentThatStartedThisActivity.getStringExtra(Intent.EXTRA_TEXT); | ||
mWeatherDisplay.setText(mForecast); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
android:layout_height="match_parent" | ||
android:padding="8dp"> | ||
|
||
<TextView | ||
android:id="@+id/tv_display_weather" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textSize="22sp" /> | ||
|
||
</FrameLayout> |