Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
2.02 rename Placeholder -> Forecast
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyla committed Mar 4, 2015
1 parent ea6e195 commit 370d9bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Expand Up @@ -44,7 +44,7 @@ protected void onCreate(Bundle savedInstanceState) {
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new PlaceholderFragment())
.add(R.id.container, new ForecastFragment())
.commit();
}
}
Expand Down Expand Up @@ -74,11 +74,11 @@ public boolean onOptionsItemSelected(MenuItem item) {
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
public static class ForecastFragment extends Fragment {

ArrayAdapter<String> mForecastAdapter;

public PlaceholderFragment() {
public ForecastFragment() {
}

@Override
Expand Down Expand Up @@ -156,7 +156,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
}
forecastJsonStr = buffer.toString();
} catch (IOException e) {
Log.e("PlaceholderFragment", "Error ", e);
Log.e("ForecastFragment", "Error ", e);
// If the code didn't successfully get the weather data, there's no point in attemping
// to parse it.
return null;
Expand All @@ -168,7 +168,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
try {
reader.close();
} catch (final IOException e) {
Log.e("PlaceholderFragment", "Error closing stream", e);
Log.e("ForecastFragment", "Error closing stream", e);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/fragment_main.xml
Expand Up @@ -7,8 +7,7 @@
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MainActivity$PlaceholderFragment">

tools:context=".MainActivity$ForecastFragment">

<ListView
android:id="@+id/listview_forecast"
Expand Down

7 comments on commit 370d9bf

@lauriewu1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been comparing my code to these commits but have yet to figure out why I get this minor error, despite error the app does run with dummy data, can someone give some guidance? Thank You.
image

@rhexgomez
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lauriewu1 is your ForecastFragment public static ?

@lauriewu1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elmargomez
image
I even copied the code from the commit(for main activity, forecastfragment java and xml) to IDE I still get that red text over ForecastFragments.

@rhexgomez
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lauriewu1 try adding static.

@lauriewu1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elmargomez tried, IDE is giving me error messages, doesn't allow it.

@lauriewu1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elmargomez Thanks, I actually just figured out from another source, just had to remove $ForecastFragment. It actually doesn't affect code logic.

@rhexgomez
Copy link

@rhexgomez rhexgomez commented on 370d9bf Nov 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually yes it does not really affect anything. The tools is only used for mocking values, which it has nothing todo with the build output :) , I thought you really want to learn about it that’s why I am concern on the error.

Please sign in to comment.