Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.text.TextUtils;
import com.google.gson.Gson;

public class Main {
    private static Gson gson = null;

    public static Object jsonToBean(String jsonStr, Class<?> cl) {
        Object obj = null;
        if (gson != null && !TextUtils.isEmpty(jsonStr)) {
            obj = gson.fromJson(jsonStr, cl);
        }
        return obj;
    }
}