Preserve results when changing orientation
app/src/main/java/eu/lepiller/nani/MainActivity.java
32 | 32 | private Button search_button; | |
33 | 33 | private TextView feedback_text; | |
34 | 34 | private EditText search_form; | |
35 | + | private static ArrayList<Result> savedResults; | |
35 | 36 | ||
36 | 37 | @Override | |
37 | 38 | protected void onCreate(Bundle savedInstanceState) { | |
… | |||
62 | 63 | new SearchTask(MainActivity.this).execute(text); | |
63 | 64 | } | |
64 | 65 | }); | |
66 | + | ||
67 | + | if(savedResults != null) { | |
68 | + | showResults(savedResults); | |
69 | + | } | |
65 | 70 | } | |
66 | 71 | ||
67 | 72 | private static class SearchTask extends AsyncTask<String, Integer, SearchResult> { | |
… | |||
137 | 142 | } | |
138 | 143 | }); | |
139 | 144 | } | |
145 | + | savedResults = searchResult; | |
140 | 146 | showResults(searchResult); | |
141 | 147 | } | |
142 | 148 |