LoadUrl
They simply load a different URL into the browser: the CommonsWare home page in one (Figure 24‑3), the Android home page in the other (Figure 24‑4). The resulting UI shows what tabbed browsing could look like on Android.
Figure 24‑3. The IntentTabDemo sample application, showing the first tab
Figure 24‑4. The IntentTabDemo sample application, showing the second tab
Using distinct subclasses for each targeted page is rather wasteful. Instead we could have packaged the URL to open as an “extra” in an and used that to spawn a general‑purpose activity, which would read the URL out of the “extra,” and use that. The proof of this is left as an exercise for the reader.
Дата добавления: 2015-05-16; просмотров: 694;