org.acra.collector
Class ConfigurationCollector

java.lang.Object
  extended by org.acra.collector.ConfigurationCollector

public final class ConfigurationCollector
extends Object

Inspects a Configuration object through reflection API in order to generate a human readable String with values replaced with their constants names. The Configuration.toString() method was not enough as values like 0, 1, 2 or 3 don't look readable to me. Using reflection API allows to retrieve hidden fields and can make us hope to be compatible with all Android API levels, even those which are not published yet.

Author:
Kevin Gaudin

Constructor Summary
ConfigurationCollector()
           
 
Method Summary
static String collectConfiguration(android.content.Context context)
          Returns the current Configuration for this application.
static String toString(android.content.res.Configuration conf)
          Use this method to generate a human readable String listing all values from the provided Configuration instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurationCollector

public ConfigurationCollector()
Method Detail

toString

public static String toString(android.content.res.Configuration conf)
Use this method to generate a human readable String listing all values from the provided Configuration instance.

Parameters:
conf - The Configuration to be described.
Returns:
A String describing all the fields of the given Configuration, with values replaced by constant names.

collectConfiguration

public static String collectConfiguration(android.content.Context context)
Returns the current Configuration for this application.

Parameters:
context - Context for the application being reported.
Returns:
A String representation of the current configuration for the application.


Copyright © 2010-2013. All Rights Reserved.