hoseinquest
hoseinquest
Reputation Top 5%
hoseinquest
2 Snippets  (247th place)
Published
1 Channel
Created
1 Channel
Following
56 points  (470th place)
Reputation
Junior Code Generator
Junior Publisher
Junior Trend Maker
Junior Popular Coder
Junior Autobiographer
Junior Famous Coder

Recent Snippets See all snippets by hoseinquest

public by hoseinquest  1775  0  5  0

android close keybiard at activity start

getWindow().setSoftInputMode(
                WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
;

public by hoseinquest  2052  3  5  0

Android Uncaught Exception Handeling (prevent force close)

Thread.setDefaultUncaughtExceptionHandler(new ExceptionHandler(this));


 public class ExceptionHandler implements java.lang.Thread.UncaughtExceptionHandler {
    private final Context myContext;

    public ExceptionHandler(Context context) {
        myContext = context;
    }

    public void uncaughtException(Thread thread, Throwable exception) {
        StringWriter stackTrace = new StringWriter();
        exception.printStackTrace(new PrintWriter(stackTrace));
        System.err.println(stackTrace);

       Intent intent = new Intent(myContext, BugReportActivity.class);
        intent.putExtra("stack", stackTrace.toString());
        myContext.startActivity(intent);
       Process.killProcess(Process.myPid());
        System.exit(10);
    }}
;