Example usage for java.lang IllegalArgumentException printStackTrace

List of usage examples for java.lang IllegalArgumentException printStackTrace

Introduction

In this page you can find the example usage for java.lang IllegalArgumentException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:Main.java

public static Collection<?> getFieldFrom(Collection<?> set, String FieldName) {
    ArrayList arrayList = new ArrayList();
    for (Object o : set) {
        try {//from www .j  a  va2s.c  om
            Object object = o.getClass().getField(FieldName).get(o);
            arrayList.add(o);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
    }
    return null;
}

From source file:Main.java

public static Bitmap getVideoThumbnail(String filePath) {
    Bitmap bitmap = null;/*from  w  ww  .  ja v a 2  s.c  o m*/
    MediaMetadataRetriever retriever = new MediaMetadataRetriever();
    try {
        retriever.setDataSource(filePath);
        bitmap = retriever.getFrameAtTime();
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (RuntimeException e) {
        e.printStackTrace();
    } finally {
        try {
            retriever.release();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
    return bitmap;
}

From source file:Main.java

private static Object invoke(Object obj, Method method) {
    if (obj == null || method == null)
        return null;
    try {/*from   w ww . ja  v a  2  s  . co m*/
        return method.invoke(obj);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:Main.java

public static void showSimpleProgressDialog(Context context, String title, String msg, boolean isCancelable) {
    try {//from  w  w  w  .  j  a  v  a  2  s.c o m
        if (mProgressDialog == null) {
            mProgressDialog = ProgressDialog.show(context, title, msg);
            mProgressDialog.setCancelable(isCancelable);
        }

        if (!mProgressDialog.isShowing()) {
            mProgressDialog.show();
        }

    } catch (IllegalArgumentException ie) {
        ie.printStackTrace();
    } catch (RuntimeException re) {
        re.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static int getYears(int year, int month, int day) {

    GregorianCalendar cal = new GregorianCalendar();
    int y, m, d, noofyears;

    y = cal.get(Calendar.YEAR);// current year ,
    m = cal.get(Calendar.MONTH);// current month 
    d = cal.get(Calendar.DAY_OF_MONTH);//current day
    cal.set(year, month, day);// here ur date 
    noofyears = y - cal.get(Calendar.YEAR);
    if ((m < cal.get(Calendar.MONTH))
            || ((m == cal.get(Calendar.MONTH)) && (d < cal.get(Calendar.DAY_OF_MONTH)))) {
        --noofyears;/* w  w w  .  j  av  a 2  s.  c o m*/
    }
    try {
        if (noofyears < 0)
            throw new IllegalArgumentException("age < 0");
    } catch (IllegalArgumentException ile) {
        ile.printStackTrace();
    }
    System.out.println(noofyears);
    return noofyears;
}

From source file:Main.java

public final static int getStaticIntValue(String name, int defvalue) {
    int result = defvalue;
    Field field = getField(name);

    if (field != null) {
        try {/*  www  .  j  a  v  a2  s . co  m*/
            result = field.getInt(null);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    return result;
}

From source file:Main.java

public static Object getStaticValue(String fieldName) {
    Field field = getField(fieldName);
    if (field == null) {
        return null;
    }/*w w  w .j a  va  2s  .  co m*/
    Object result = null;

    try {
        result = field.get(null);
    } catch (IllegalArgumentException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }

    return result;
}

From source file:Main.java

public static void setActionBarTabsShowAtBottom(ActionBar actionbar, boolean showAtBottom) {
    try {/*from   w  w w  .  j  a  v a2 s.c  o m*/
        Method method = Class.forName("android.app.ActionBar").getMethod("setTabsShowAtBottom",
                new Class[] { boolean.class });
        try {
            method.invoke(actionbar, showAtBottom);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void setActionModeHeaderHidden(ActionBar actionbar, boolean hidden) {
    try {/*from   w ww  .j  a  v  a  2s.  c  o m*/
        Method method = Class.forName("android.app.ActionBar").getMethod("setActionModeHeaderHidden",
                new Class[] { boolean.class });
        try {
            method.invoke(actionbar, hidden);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void setActionBarViewCollapsable(ActionBar actionbar, boolean collapsable) {
    try {//w w  w. ja va 2s  .c om
        Method method = Class.forName("android.app.ActionBar").getMethod("setActionBarViewCollapsable",
                new Class[] { boolean.class });
        try {
            method.invoke(actionbar, collapsable);
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
    }
}