title: how to haveinstance of activity converted to gson
body: <p>In the below code, I am trying to convert activity to a JSON object so I can pass such an object to a service via intent. please refer to the code posted in code_1 and code_2 sections. However, when the app is executed, I receive
  the below-posted error.</p>
  
  <pre><code>    java.lang.IllegalArgumentException: class android.content.res.ColorStateList declares multiple JSON fields named mChangingConfigurations
  </code></pre>
  
  <p>please let me know why I receive such error and how to solve it.</p>
  
  <p><strong>code_1</strong>:</p>
  
  <pre><code>public class JsonConverterAndroidOS implements IConvertToJson {
      @Override
      public String convertToJosn(Context ctx) {
      Gson gson = new Gson();
      Log.i("", "gson.toJson(ctx) : " + gson.toJson(ctx));
      return gson.toJson(ctx);
      }
  }
  </code></pre>
  
  <p><strong>code_2</strong>:</p>
  
  <pre><code>this.mBtn_Start_GPS_Readings.setOnClickListener(new View.OnClickListener() {
  
          @Override
          public void onClick(View v) {
              Toast.makeText(getApplicationContext(), "GPS_READINGS", Toast.LENGTH_SHORT).show();
              Intent intentStartGPSService = new Intent(getApplicationContext(), GPSService.class);
              intentStartGPSService.setAction(ACTION_START_GPS_READING);
  
              //activity to json conversion
              IConvertToJson converter = new JsonConverterAndroidOS();
              String convertedToJson = converter.convertToJosn(MainActivity.this);
              intentStartGPSService.putExtra(KEY_MAIN_ACTIVITY_INSTANCE, convertedToJson);
              //startService(intentStartGPSService);
          }
      });
  </code></pre>
  
  <p><strong>error</strong>:</p>
  
  <pre><code>2019-06-15 10:45:12.898 1983-2013/com.example.gps_v10 E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
  2019-06-15 10:45:12.899 1983-2013/com.example.gps_v10 E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da
  2019-06-15 10:45:26.411 1983-1983/com.example.gps_v10 E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.example.gps_v10, PID: 1983
  java.lang.IllegalArgumentException: class android.content.res.ColorStateList declares multiple JSON fields named mChangingConfigurations
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:172)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
      at com.google.gson.Gson.getAdapter(Gson.java:457)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
      at com.google.gson.Gson.getAdapter(Gson.java:457)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
      at com.google.gson.Gson.getAdapter(Gson.java:457)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166)
      at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102)
      at com.google.gson.Gson.getAdapter(Gson.java:457)
      at com.google.gson.Gson.toJson(Gson.java:695)
      at com.google.gson.Gson.toJson(Gson.java:682)
      at com.google.gson.Gson.toJson(Gson.java:637)
      at com.google.gson.Gson.toJson(Gson.java:617)
      at com.example.gps_v10.JsonConverterAndroidOS.convertToJosn(JsonConverterAndroidOS.java:12)
      at com.example.gps_v10.MainActivity$1.onClick(MainActivity.java:49)
      at android.view.View.performClick(View.java:6256)
      at android.view.View$PerformClick.run(View.java:24701)
      at android.os.Handler.handleCallback(Handler.java:789)
      at android.os.Handler.dispatchMessage(Handler.java:98)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6541)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
  2019-06-15 10:45:26.422 1983-1990/com.example.gps_v10 I/zygote: Do partial code cache collection, code=30KB, data=26KB
  2019-06-15 10:45:26.422 1983-1990/com.example.gps_v10 I/zygote: After code cache collection, code=30KB, data=26KB
  2019-06-15 10:45:26.422 1983-1990/com.example.gps_v10 I/zygote: Increasing code cache capacity to 128KB
  </code></pre>