/** * Helper method to Perform Reflection to Get Static Field of Provided Type. Field is assumed * Private. * * @param fieldName * @param type * @return */ public static <T> T getFieldFromReflection( String fieldName, Class<?> containingClass, Class<T> type) { try { Field desiredField = containingClass.getDeclaredField(fieldName); desiredField.setAccessible(true); return type.cast(desiredField.get(null)); } catch (NoSuchFieldException e) { JASLog.log() .severe( "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.", fieldName, type.getSimpleName()); e.printStackTrace(); } catch (IllegalArgumentException e) { JASLog.log() .severe( "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.", fieldName, type.getSimpleName()); e.printStackTrace(); } catch (IllegalAccessException e) { JASLog.log() .severe( "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.", fieldName, type.getSimpleName()); e.printStackTrace(); } catch (SecurityException e) { JASLog.log() .severe( "Obfuscation needs to be updated to access the %s %s. Please notify modmaker Immediately.", fieldName, type.getSimpleName()); e.printStackTrace(); } return null; }
private void initializePluginAPI(TiWebView webView) { try { synchronized (this.getClass()) { // Initialize if (enumPluginStateOff == null) { Class<?> webSettings = Class.forName("android.webkit.WebSettings"); Class<?> pluginState = Class.forName("android.webkit.WebSettings$PluginState"); Field f = pluginState.getDeclaredField("OFF"); enumPluginStateOff = (Enum<?>) f.get(null); f = pluginState.getDeclaredField("ON"); enumPluginStateOn = (Enum<?>) f.get(null); f = pluginState.getDeclaredField("ON_DEMAND"); enumPluginStateOnDemand = (Enum<?>) f.get(null); internalSetPluginState = webSettings.getMethod("setPluginState", pluginState); // Hidden APIs // http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/java/android/webkit/WebView.java;h=bbd8b95c7bea66b7060b5782fae4b3b2c4f04966;hb=4db1f432b853152075923499768639e14403b73a#l2558 internalWebViewPause = webView.getClass().getMethod("onPause"); internalWebViewResume = webView.getClass().getMethod("onResume"); } } } catch (ClassNotFoundException e) { Log.e(TAG, "ClassNotFound: " + e.getMessage(), e); } catch (NoSuchMethodException e) { Log.e(TAG, "NoSuchMethod: " + e.getMessage(), e); } catch (NoSuchFieldException e) { Log.e(TAG, "NoSuchField: " + e.getMessage(), e); } catch (IllegalAccessException e) { Log.e(TAG, "IllegalAccess: " + e.getMessage(), e); } }
private void setVars(Map<Var, Node> values, String fieldName) { if (values.isEmpty()) { return; } try { Field f = Query.class.getDeclaredField(fieldName); f.setAccessible(true); List<String> orig = (List<String>) f.get(query); List<String> lst = null; if (orig != null) { lst = new ArrayList<String>(); for (String s : orig) { Node n = null; if (s.startsWith("?")) { Var v = Var.alloc(s.substring(1)); n = values.get(v); } lst.add(n == null ? s : n.toString()); } f.set(query, lst); } } catch (NoSuchFieldException e) { throw new IllegalStateException(e.getMessage(), e); } catch (SecurityException e) { throw new IllegalStateException(e.getMessage(), e); } catch (IllegalAccessException e) { throw new IllegalStateException(e.getMessage(), e); } }
public static final void checkDataVersion(final Object data1, final Object data2) { if (null != data1) { try { final Field data1Version = data1.getClass().getDeclaredField("version"); // LOG.debug("find updId in methodinvocation"); data1Version.setAccessible(true); final long data1Verlong = data1Version.getLong(data1); if (null == data2) { final Code3gException pos3ge = new Code3gException("B341005"); pos3ge.setStatus(1); throw pos3ge; } final Field data2Version = data2.getClass().getDeclaredField("version"); // LOG.debug("find updId in methodinvocation"); data2Version.setAccessible(true); final long data2Verlong = data2Version.getLong(data2); if (data1Verlong != data2Verlong) { final Code3gException pos3ge = new Code3gException("B341005"); pos3ge.setStatus(1); throw pos3ge; } } catch (NoSuchFieldException e) { LOG.error("check version error, " + e.getMessage(), e); } catch (IllegalArgumentException e) { LOG.error("check version error, " + e.getMessage(), e); } catch (IllegalAccessException e) { LOG.error("check version error, " + e.getMessage(), e); } } }
public static void removeGoalSelectors(org.bukkit.entity.Entity paramEntity) { try { if (_goalSelector == null) { _goalSelector = EntityInsentient.class.getDeclaredField("goalSelector"); _goalSelector.setAccessible(true); } if ((((CraftEntity) paramEntity).getHandle() instanceof EntityInsentient)) { EntityInsentient localEntityInsentient = (EntityInsentient) ((CraftEntity) paramEntity).getHandle(); PathfinderGoalSelector localPathfinderGoalSelector = new PathfinderGoalSelector( ((CraftWorld) paramEntity.getWorld()).getHandle().methodProfiler); _goalSelector.set(localEntityInsentient, localPathfinderGoalSelector); } } catch (IllegalArgumentException localIllegalArgumentException) { localIllegalArgumentException.printStackTrace(); } catch (IllegalAccessException localIllegalAccessException) { localIllegalAccessException.printStackTrace(); } catch (NoSuchFieldException localNoSuchFieldException) { localNoSuchFieldException.printStackTrace(); } catch (SecurityException localSecurityException) { localSecurityException.printStackTrace(); } }
static { try { itemDamageField = getPrivateField(ItemStack.class, "itemDamage", "field_77991_e", "e"); } catch (NoSuchFieldException e) { e.printStackTrace(); } }
/** @param concept */ public void setConcept(URI concept) { if (validility) { try { Field field = EntityImpl.class.getDeclaredField("concept"); if (concept != null) { Object newObj = new ClassURI(concept); writemapper.replaceObject(field.getAnnotation(winter.class), this, newObj); } else { writemapper.deleteObject( field.getAnnotation(winter.class), null, this, field.getAnnotation(winter.class).var(), false); } } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } } this.concept = new ClassURI(concept); }
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { if (fromUser) { // for java.lang.ClassCastException Object tag = seekBar.getTag(); int n; if (tag instanceof Integer) n = (Integer) tag; else if (tag instanceof String) n = Integer.parseInt((String) tag); else throw new IllegalArgumentException("wtf exception"); TextView textView; try { textView = (TextView) this.getClass().getDeclaredField("text" + String.valueOf(n)).get(this); textView.setText( String.format("%.0f db", EqualizerBandsFragment.convertProgressToGain(progress))); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } saveBound(progress, n); BassPlayer.updateFX(progress, n); } }
/** * Update the all the opengl textures belonging to a sketch imediately. * * @param fs The fullscreen object * @throws NoSuchFieldException * @throws SecurityException * @throws IllegalAccessException * @throws IllegalArgumentException */ public static void update(FullScreenBase fs) { // Now, if in opengl mode all the textures will be erased, // we'll have to call updatePixels() on all of them! // Oh, and we have to use reflection, because we don't know if // opengl is being used. So the class names might not even be there. if (fs.isGL()) { try { PGraphics g = fs.getSketch().g; Field field = PGraphics3D.class.getDeclaredField("textures"); field.setAccessible(true); // make private variable public! PImage textures[] = (PImage[]) field.get(g); for (int i = 0; i < textures.length; i++) { if (textures[i] != null) { textures[i].updatePixels(); } } } catch (SecurityException e) { System.err.println("FullScreen-API: Unknown error: " + e.getMessage()); e.printStackTrace(); } catch (NoSuchFieldException e) { System.err.println( "FullScreen-API: Couldn't find any field 'textures' in processing.core.PGraphics3D"); System.err.println( "Seems your processing version doesn't match this version of the fullscreen api"); e.printStackTrace(); } catch (IllegalArgumentException e) { System.err.println("FullScreen-API: Unknown error: " + e.getMessage()); e.printStackTrace(); } catch (IllegalAccessException e) { System.err.println("FullScreen-API: Unknown error: " + e.getMessage()); e.printStackTrace(); } } }
/** * When the DataSet editor runs, modifications to the queryText as done in the BindParameter * function will get written to the queryText. To avoid this, we test if the query is being run by * the DataSet editor. * * <p>BIRT 2.5 has added a new Task type that identifies the DataSet editor so that this code is * no longer required. * * @param reportContext * @return */ public static boolean isDataSetEditor(IReportContext reportContext) { try { // get the protect field 'context' from reportContext @SuppressWarnings({"rawtypes"}) Class rciClass = reportContext.getClass(); Field fieldFromScript = rciClass.getDeclaredField("context"); if (fieldFromScript == null) { throw new NoSuchFieldException("Reporting Access to context from IReportContext"); } // instantiate the ExecutionContext object that // populates the context field fieldFromScript.setAccessible(true); Object execContext = fieldFromScript.get(reportContext); ExecutionContext ectx = (ExecutionContext) execContext; IEngineTask et = ectx.getEngineTask(); if ("DummyEngineTask".equalsIgnoreCase(et.getClass().getSimpleName())) { logger.info("Is Data Set Editor"); return true; } } catch (SecurityException e) { logger.warning("BIRT Functions, check for DataSet Editor: " + e.getMessage()); } catch (NoSuchFieldException e) { logger.warning("BIRT Functions, check for DataSet Editor: " + e.getMessage()); } catch (IllegalArgumentException e) { logger.warning("BIRT Functions, check for DataSet Editor: " + e.getMessage()); } catch (IllegalAccessException e) { logger.warning("BIRT Functions, check for DataSet Editor: " + e.getMessage()); } logger.finest("Is Not a Data Set Editor"); return false; }
public static int getResourseIdByName(String packageName, String className, String name) { Class r = null; int id = 0; try { r = Class.forName(packageName + ".R"); Class[] classes = r.getClasses(); Class desireClass = null; for (int i = 0; i < classes.length; i++) { if (classes[i].getName().split("\\$")[1].equals(className)) { desireClass = classes[i]; break; } } if (desireClass != null) id = desireClass.getField(name).getInt(desireClass); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } return id; }
public static Object getStaticFieldOjbect(String class_name, String filedName) { try { Class obj_class = Class.forName(class_name); Field field = obj_class.getDeclaredField(filedName); field.setAccessible(true); return field.get(null); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
/** * 使用检索标准对象查询记录数 * * @param detachedCriteria * @return */ @SuppressWarnings("rawtypes") public long count(DetachedCriteria detachedCriteria) { Criteria criteria = detachedCriteria.getExecutableCriteria(getSession()); long totalCount = 0; try { // Get orders Field field = CriteriaImpl.class.getDeclaredField("orderEntries"); field.setAccessible(true); List orderEntrys = (List) field.get(criteria); // Remove orders field.set(criteria, new ArrayList()); // Get count criteria.setProjection(Projections.rowCount()); totalCount = Long.valueOf(criteria.uniqueResult().toString()); // Clean count criteria.setProjection(null); // Restore orders field.set(criteria, orderEntrys); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } return totalCount; }
/** * 获取状态栏高度 * * @param activity * @return */ public int getStatusHeight(Activity activity) { int statusHeight = 0; Rect localRect = new Rect(); activity.getWindow().getDecorView().getWindowVisibleDisplayFrame(localRect); statusHeight = localRect.top; if (0 == statusHeight) { Class<?> localClass; try { localClass = Class.forName("com.android.internal.R$dimen"); Object localObject = localClass.newInstance(); int i5 = Integer.parseInt(localClass.getField("status_bar_height").get(localObject).toString()); statusHeight = activity.getResources().getDimensionPixelSize(i5); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (NumberFormatException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } } return statusHeight; }
/** * 将原视图 宽高,padding,margin 按比例重新布 * * @param view * @param scale */ public static void relayoutViewWithScale(View view, float scale) { if (view == null) { return; } resetViewLayoutParams(view, scale); if (view instanceof ViewGroup) { View[] where = null; try { Field field = ViewGroup.class.getDeclaredField("mChildren"); field.setAccessible(true); where = (View[]) field.get(view); } catch (NoSuchFieldException e) { e.printStackTrace(); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } if (where != null) { for (View child : where) { relayoutViewWithScale(child, scale); } } } }
public void setInnerFocus(boolean bFocus) { mBMyFocus = bFocus; if (mBMyFocus) { requestFocus(); } else { Field field; try { field = getClass().getSuperclass().getSuperclass().getDeclaredField("mPrivateFlags"); field.setAccessible(true); field.set(this, new Integer(2)); clearFocus(); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
private String getValue(QualifiedName name, ASTNode astNode, final JstType jstType) { TranslateInfo tInfo = TranslateCtx.ctx().getTranslateInfo(jstType); String typeName = name.getQualifier().getFullyQualifiedName(); String fullName = tInfo.getImported(typeName); try { Class<?> toClass = Class.forName(fullName); Field field = toClass.getField(name.getName().toString()); return (String) field.get(toClass); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; }
public void SetAlertDialog(DialogInterface arg0, boolean show) { if (show) { try { Field mField = arg0.getClass().getSuperclass().getDeclaredField("mShowing"); mField.setAccessible(true); mField.set(arg0, true); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } else { try { Field mField = arg0.getClass().getSuperclass().getDeclaredField("mShowing"); mField.setAccessible(true); mField.set(arg0, false); } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
/** * 将父类对像转成子类的对象,不能有带参数构造方法 仅仅是将同名的字段值复制 * * @param parent * @param childClass * @return */ public static Object castToChild(Object parent, Class childClass) { // if(parent instanceof type) // { // return parent; // } Class parentClass = parent.getClass(); if (parentClass == childClass) return parent; if (parentClass.isAssignableFrom(childClass)) { Field[] parentFields = parentClass.getDeclaredFields(); try { Object child = childClass.newInstance(); for (Field field : parentFields) { field.setAccessible(true); Field childField = childClass.getSuperclass().getDeclaredField(field.getName()); childField.setAccessible(true); childField.set(child, field.get(parent)); } return child; } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } } return null; }
private static int getValueFor(String enumeration) { try { // Get last part and first part String[] stringItems = enumeration.split("\\."); String lastPart = stringItems[stringItems.length - 1]; String firstPart = ""; for (int a = 0; a < stringItems.length - 2; a++) firstPart = firstPart.concat(stringItems[a] + "."); firstPart = firstPart.concat(stringItems[stringItems.length - 2]); Class c = Class.forName(firstPart); // get the class try { Field enumerator = c.getField(lastPart); // get the field (lastPart) from the class try { return enumerator.getInt(c); // get the value of the field } catch (IllegalArgumentException e2) { e2.printStackTrace(); } catch (IllegalAccessException e2) { e2.printStackTrace(); } } catch (SecurityException e1) { e1.printStackTrace(); } catch (NoSuchFieldException e1) { e1.printStackTrace(); } } catch (ClassNotFoundException e) { e.printStackTrace(); } return 0; }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); // backward compatibility; matchCorrelation could have a value if read from old definition if (matchCorrelations == null) matchCorrelations = new ArrayList<OScope.CorrelationSet>(); if (matchCorrelation != null) { matchCorrelations.add(matchCorrelation); } // backward compatibility; joinCorrelations could be null if read from old definition if (joinCorrelations == null) { try { Field field = OEvent.class.getDeclaredField("joinCorrelations"); field.setAccessible(true); field.set(this, new ArrayList<CorrelationSet>()); } catch (NoSuchFieldException nfe) { throw new IOException(nfe.getMessage()); } catch (IllegalAccessException iae) { throw new IOException(iae.getMessage()); } } // backward compatibility; joinCorrelation could have a value if read from old definition if (joinCorrelation != null) { joinCorrelation.hasJoinUseCases = true; joinCorrelations.add(joinCorrelation); } }
Engine() { super(); prefs = GalleryWallpaper.this.getSharedPreferences(SHARED_PREFS_NAME, Context.MODE_PRIVATE); prefs.registerOnSharedPreferenceChangeListener(this); this.onSharedPreferenceChanged(prefs, GalleryWallpaper.SHARED_PREFS_REPLACEIMAGE); this.onSharedPreferenceChanged(prefs, GalleryWallpaper.SHARED_PREFS_SYNC); onSharedPreferenceChanged(prefs, null); backgroundPaint.setFilterBitmap(false); backgroundPaint.setAntiAlias(true); backgroundPaint.setColor(Color.BLACK); textPaint.setAntiAlias(true); textPaint.setColor(Color.WHITE); textPaint.setShadowLayer(5f, 1f, 1f, Color.GRAY); textPaint.setSubpixelText(true); textPaint.setTextAlign(Paint.Align.LEFT); textPaint.setTextSize(18); textPaint.setTypeface(Typeface.MONOSPACE); this.setTouchEventsEnabled(true); if (Build.VERSION.SDK_INT >= 14) { try { // hinting = textPaint.HINTING_ON; int hinting = textPaint.getClass().getField("HINTING_ON").getInt(textPaint); // textPaint.setHinting(hinting); textPaint.getClass().getMethod("setHinting", int.class).invoke(textPaint, hinting); } catch (IllegalAccessException e) { System.err.println(e.toString()); } catch (InvocationTargetException e) { System.err.println(e.toString()); } catch (NoSuchMethodException e) { System.err.println(e.toString()); } catch (NoSuchFieldException e) { System.err.println(e.toString()); } } }
/** 实现放大缩小控件隐藏 */ public static void setZoomControlGone(WebView view) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { // 用于判断是否为Android 3.0系统, 然后隐藏缩放控件 view.getSettings().setDisplayZoomControls(false); } else { // Android 3.0(11) 以下使用以下方法: // 利用java的反射机制 Class classType; Field field; try { classType = WebView.class; field = classType.getDeclaredField("mZoomButtonsController"); field.setAccessible(true); ZoomButtonsController mZoomButtonsController = new ZoomButtonsController(view); mZoomButtonsController.getZoomControls().setVisibility(View.GONE); try { field.set(view, mZoomButtonsController); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchFieldException e) { e.printStackTrace(); } } }
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { if (mUnfoldableView.isUnfolded()) { inflater.inflate(R.menu.detail_bar, menu); } else { inflater.inflate(R.menu.main_bar, menu); SearchManager searchManager = (SearchManager) getActivity().getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setIconifiedByDefault(true); int id = searchView .getContext() .getResources() .getIdentifier("android:id/search_close_btn", null, null); ((ImageView) Views.find(searchView, id)).setImageResource(R.drawable.ab_search_clear); int searchId = searchView .getContext() .getResources() .getIdentifier("android:id/search_mag_icon", null, null); // SearchView.SearchAutoComplete autoComplete = // (SearchView.SearchAutoComplete)ll3.getChildAt(0); // Drawable drawable= getResources().getDrawable(R.drawable.ic_action_search); // drawable.setBounds(0, 0, drawable.getMinimumWidth(), // drawable.getMinimumHeight()); ((ImageView) Views.find(searchView, searchId)).setImageResource(R.drawable.ic_action_search); int searchId2 = searchView .getContext() .getResources() .getIdentifier("android:id/search_button", null, null); ((ImageView) Views.find(searchView, searchId2)) .setBackgroundResource(R.drawable.ic_action_search); searchView.setSearchableInfo( searchManager.getSearchableInfo(getActivity().getComponentName())); try { Field searchField = SearchView.class.getDeclaredField("mSearchButton"); searchField.setAccessible(true); ImageView searchBtn = (ImageView) searchField.get(searchView); searchBtn.setImageResource(R.drawable.ic_action_search); searchField = SearchView.class.getDeclaredField("mSearchPlate"); searchField.setAccessible(true); // LinearLayout searchPlate = (LinearLayout)searchField.get(searchView); // Drawable drawable= // getResources().getDrawable(R.drawable.ic_action_search); // drawable.setBounds(0, 0, drawable.getMinimumWidth(), // drawable.getMinimumHeight()); // // ((TextView)searchPlate.getChildAt(0)).setCompoundDrawables(drawable,null,null,null); // searchPlate.setBackgroundResource(R.drawable.edit_text_bkg); } catch (NoSuchFieldException e) { Log.e(TAG, e.getMessage(), e); } catch (IllegalAccessException e) { Log.e(TAG, e.getMessage(), e); } } }
static { try { _cookieSet = AbstractSession.class.getDeclaredField("_cookieSet"); _cookieSet.setAccessible(true); } catch (NoSuchFieldException e) { throw new RuntimeException(e.getMessage(), e); } }
public static Class getClass(String type) { try { return DataType.class.getDeclaredField(type).getType(); } catch (NoSuchFieldException noSuchFieldException) { noSuchFieldException.printStackTrace(); return null; } }
public Field getKeyField() { try { return KeyEvent.class.getField("VK_" + key.toUpperCase()); } catch (NoSuchFieldException e) { e.printStackTrace(); } return null; // This shouldn't be reached }
static { try { goalSelectorField = EntityInsentient.class.getDeclaredField("goalSelector"); goalSelectorField.setAccessible(true); } catch (NoSuchFieldException e) { e.printStackTrace(); } }
static void initField() { try { nativeIntField = Bitmap.Config.class.getDeclaredField("nativeInt"); nativeIntField.setAccessible(true); } catch (NoSuchFieldException e) { nativeIntField = null; e.printStackTrace(); } }
public HiddenReflector() { try { mCursorDrawableRes = TextView.class.getDeclaredField("mCursorDrawableRes"); mCursorDrawableRes.setAccessible(true); } catch (NoSuchFieldException e) { e.printStackTrace(); } }