package com.newsrob.util; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import android.content.SharedPreferences; public class SDK9Helper { private static final Method sApplyMethod = findApplyMethod(); private static Method findApplyMethod() { try { Class cls = SharedPreferences.Editor.class; return cls.getMethod("apply"); } catch (NoSuchMethodException unused) { // fall through } return null; } public static void apply(SharedPreferences.Editor editor) { if (sApplyMethod != null) { try { sApplyMethod.invoke(editor); return; } catch (InvocationTargetException unused) { // fall through } catch (IllegalAccessException unused) { // fall through } } editor.commit(); } }