private static Object ConvertJsonToData(string dataJson = null)
 {
     return(new Gson().FromJson(dataJson, TypeToken.GetParameterized(
                                    TypeToken.Get(Class.FromType(typeof(HashMap))).Type,
                                    TypeToken.Get(Class.FromType(typeof(String))).Type,
                                    TypeToken.Get(Class.FromType(typeof(Object))).Type)
                                .Type));
 }
Example #2
0
        public List <DefaultFieldTypeWithHints> GetDefaultFieldTypes()
        {
            var    type = Java.Lang.Class.FromType(typeof(List <DefaultFieldTypeWithHints>));
            Type   fieldTypeListType = TypeToken.Get(type).GetType();
            Stream inputStream       = mResources.OpenRawResource(Resource.Raw.default_field_types);
            List <DefaultFieldTypeWithHints> fieldTypes = null;

            using (Reader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")))
            {
                try
                {
                    fieldTypes = mGson.FromJson(reader, type);
                }
                catch (Java.IO.IOException ex)
                {
                    Util.Loge(ex, "Exception during deserialization of FieldTypes.");
                }
            }
            return(fieldTypes);
        }