Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Color;
import android.view.View;
import java.util.HashMap;

public class Main {
    private static HashMap<String, Integer> colorMap;

    public static int getHeaderBackgroundColor(View convertView, String header) {
        if (colorMap == null) {
            colorMap = new HashMap<>();
            //            colorMap.put("grocery_or_supermarket", convertView.getResources().getColor(R.color.grocery_or_supermarket));
            //            colorMap.put("hardware_store",convertView.getResources().getColor(R.color.hardware_store));
            //            colorMap.put("clothing_store",convertView.getResources().getColor(R.color.clothing_store));
            //            colorMap.put(Constants.UNCATEGORIZED,convertView.getResources().getColor(R.color.uncategorized));
            //            colorMap.put(Constants.GOOGLE_CALENDAR_CATEGORY,convertView.getResources().getColor(R.color.google_calendar));

        }
        if (colorMap.get(header) == null)
            return Color.WHITE;
        return colorMap.get(header);
    }
}