Question: Trying to create a multiplication table for the number 1-12 with the DummyContent.java class from Android studio. all I really need to change is the
Trying to create a multiplication table for the number 1-12 with the DummyContent.java class from Android studio. all I really need to change is the make detail or the nested class at the bottom of the java file but I don't know where to start. or where to put the correct information.
0x0=0 all the way through 12 x 12 = 144 for example, in a list.
import android.os.Bundle; 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 final List
ITEMS = new ArrayList (); /** * A map of sample (dummy) items, by ID. */ public static final Map ITEM_MAP = new HashMap (); private static final int COUNT = 12; static { // Add some sample items. for (int i = 0; i <= COUNT; i++) { addItem(createDummyItem(i)); } } private static void addItem(DummyItem item) { ITEMS.add(item); ITEM_MAP.put(item.id, item); } private static DummyItem createDummyItem(int position) { return new DummyItem(String.valueOf(position), "Item " + position, makeDetails(position)); } private static String makeDetails(int position) { StringBuilder builder = new StringBuilder(); builder.append("Times Table for: ").append(position); { builder.append(" 0 x 0= 0 " + "0 x 1= 0 " + "0 x 2= 0 " + "0 x 3= 0 " + "0 x 4= 0 "+ "0 x 4= 0 "+ "0 x 5= 0 "+ "0 x 6= 0 "); } return builder.toString(); } //for (int i = 1; i <= 12 ; i++) { //for (int j = 1; j <= 10; j++) //{ /** * A dummy item representing a piece of content. */ public static class DummyItem { public final String id; public final String content; public final String details; public DummyItem(String id, String content, String details) { this.id = id; this.content = content; this.details = details; } @Override public String toString() { return content; } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
