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

Commit de032c1

Browse files
author
Lyla
committed
1.04 Add dummy data
1 parent fab554b commit de032c1

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

app/src/main/java/com/example/android/sunshine/app/MainActivity.java

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
1+
/*
2+
* Copyright (C) 2014 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package com.example.android.sunshine.app;
217

3-
import android.support.v7.app.ActionBarActivity;
4-
import android.support.v4.app.Fragment;
518
import android.os.Bundle;
19+
import android.support.v4.app.Fragment;
20+
import android.support.v7.app.ActionBarActivity;
621
import android.view.LayoutInflater;
722
import android.view.Menu;
823
import android.view.MenuItem;
924
import android.view.View;
1025
import android.view.ViewGroup;
1126

27+
import java.util.ArrayList;
28+
import java.util.Arrays;
29+
import java.util.List;
30+
31+
1232

1333
public class MainActivity extends ActionBarActivity {
1434

@@ -55,7 +75,19 @@ public PlaceholderFragment() {
5575

5676
@Override
5777
public View onCreateView(LayoutInflater inflater, ViewGroup container,
58-
Bundle savedInstanceState) {
78+
Bundle savedInstanceState) {
79+
80+
// Create some dummy data for the ListView. Here's a sample weekly forecast
81+
String[] data = {
82+
"Mon 6/23 - Sunny - 31/17",
83+
"Tue 6/24 - Foggy - 21/8",
84+
"Wed 6/25 - Cloudy - 22/17",
85+
"Thurs 6/26 - Rainy - 18/11",
86+
"Fri 6/27 - Foggy - 21/10",
87+
"Sat 6/28 - TRAPPED IN WEATHERSTATION - 23/18",
88+
"Sun 6/29 - Sunny - 20/7"
89+
};
90+
List<String> weekForecast = new ArrayList<String>(Arrays.asList(data));
5991
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
6092
return rootView;
6193
}

0 commit comments

Comments
 (0)