@Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.typein);
   try {
     Intent intent = getIntent();
     if (null == intent) {
       finish();
       return;
     }
     String[] saved = intent.getStringArrayExtra(SAVED);
     if (null == saved) {
       finish();
       return;
     }
     Type type = Types.restoreType(saved, Files.types());
     if (null == type) {
       finish();
       return;
     }
     Program program = type.restore(saved);
     if (null == program) {
       finish();
       return;
     }
     scrollView = (ScrollView) findViewById(R.id.sourceCodeVScroll);
     sourceView = new SourceView(this, type, program);
     ViewGroup.LayoutParams params =
         new ViewGroup.LayoutParams(
             ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
     sourceView.setLayoutParams(params);
     sourceView.setTextLayout(textLayout());
     sourceView.setTextSize(textSize());
     sourceView.setVisibleWhitesapces(visibleWhitespaces());
     scrollView.addView(sourceView);
     scrollView.setOnTouchListener(new OnTouch(this));
     registerForContextMenu(scrollView);
     if (keepScreenOn()) {
       getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
     }
   } catch (Throwable throwable) {
     AndroidErrorHandler.d(throwable);
     finish();
   }
 }
 public static void startActivity(Context context, Type type, Program program) {
   Intent intent = new Intent(context, TypeInActivity.class);
   intent.putExtra(TypeInActivity.SAVED, type.save(program));
   context.startActivity(intent);
 }