Help with examples from "Rapid Android Development"

@svan I added a check for null, and it’s working now (in both Java and Android mode). I also had to change the ‘for’ loop to start from zero. Here’s the final code.

Table groceries;

void setup() {
// groceries = new Table(this,“groceries.txt”);
groceries = new Table();
groceries = loadTable(“groceries.tsv”,“header,tsv”);

textSize(24);
rectMode(CENTER);
textAlign(CENTER,CENTER);
noStroke();
noLoop();
background(0);

int count = groceries.getRowCount();

for (int row=0; row<count; row++) {
float rowHeight = height / count;
String amount = groceries.getString(row,0);
String unit = groceries.getString(row,1);
String item = groceries.getString(row,2);
String source = groceries.getString(row,3);
if (source == null) {
fill(127);
} else {
if (groceries.getString(row,3).equals(“store”)) {
fill(color(255,110,50));
} else if (groceries.getString(row,3).equals(“market”)) {
fill(color(50,220,255));
} else {
fill(127);
}
}
rect(width/2,rowHeight/2,width,rowHeight);
fill(255);
text(amount+" “+unit+” "+item,width/2,rowHeight/2);
translate(0,rowHeight);
}
}