Problem Android App dev tut 32

+2 John Smith · February 27, 2015
Hello , hat is wrong with the code? When i launch the project i get force close from emulator.

package com.grid.masterflow.dummy;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

 * Helper class for providing sample content for user interfaces created by
 * Android template wizards.
 * TODO: Replace all uses of this class before publishing your app.
public class DummyContent {

     * An array of sample (dummy) items.
    public static List ITEMS = new ArrayList();

     * A map of sample (dummy) items, by ID.
    public static Map ITEM_MAP = new HashMap();

    static {
        // Add 3 sample items.
        addItem(new DummyItem("1", "Youtube",""));
        addItem(new DummyItem("2", "Fillist",""));
        addItem(new DummyItem("3", "Theneboston",""));

    private static void addItem(DummyItem item) {
        ITEM_MAP.put(, item);

     * A dummy item representing a piece of content.
    public static class DummyItem {
        public String id;
        public String item_name;
        public String url;

        public DummyItem(String id, String item_name,String url) {
   = id;
            this.item_name = item_name;
            this.url = url;

        public String toString() {
            return item_name;

WebpageDetailFragment :
package com.grid.masterflow;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;

import com.grid.masterflow.dummy.DummyContent;

 * A fragment representing a single Webpage detail screen.
 * This fragment is either contained in a {@link WebpageListActivity}
 * in two-pane mode (on tablets) or a {@link WebpageDetailActivity}
 * on handsets.
public class WebpageDetailFragment extends Fragment {
     * The fragment argument representing the item ID that this fragment
     * represents.
    public static final String ARG_ITEM_ID = "item_id";

     * The dummy content this fragment is presenting.
    private DummyContent.DummyItem mItem;

     * Mandatory empty constructor for the fragment manager to instantiate the
     * fragment (e.g. upon screen orientation changes).
    public WebpageDetailFragment() {

    public void onCreate(Bundle savedInstanceState) {

        if (getArguments().containsKey(ARG_ITEM_ID)) {
            // Load the dummy content specified by the fragment
            // arguments. In a real-world scenario, use a Loader
            // to load content from a content provider.
            mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_webpage_detail, container, false);

        // Show the dummy content as text in a TextView.
        if (mItem != null) {

        return rootView;


<?xml version="1.0" encoding="utf-8" ?>
    <WebView xmlns:android=""

Post a Reply


Oldest  Newest  Rating
+1 Spikeedoo G · March 3, 2015
I am sorry this might not be it....but looking at your code compared to my working code the only thing I saw different was:

You have
public static List ITEMS = new ArrayList();

I have
public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();


You have

public static Map ITEM_MAP = new HashMap();

I have

public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();

I hope this can help!  If not, I am sorry.  I am new to helping people with code :)
  • 1

Java / Android Development


Very popular language used to create desktop applications, website applets, and Android apps.

Bucky Roberts Administrator