public boolean appCrashed(
        String processName,
        int pid,
        String shortMsg,
        String longMsg,
        long timeMillis,
        String stackTrace) {
      if (mVerbose > 0) {
        StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskWrites();
        System.err.println("// CRASH: " + processName + " (pid " + pid + ")");
        System.err.println("// Short Msg: " + shortMsg);
        System.err.println("// Long Msg: " + longMsg);
        System.err.println("// Build Label: " + Build.FINGERPRINT);
        System.err.println("// Build Changelist: " + Build.VERSION.INCREMENTAL);
        System.err.println("// Build Time: " + Build.TIME);
        System.err.println("// " + stackTrace.replace("\n", "\n// "));
        StrictMode.setThreadPolicy(savedPolicy);
      }

      if (!mIgnoreCrashes || mRequestBugreport) {
        synchronized (Monkey.this) {
          if (!mIgnoreCrashes) {
            mAbort = true;
          }
          if (mRequestBugreport) {
            mRequestAppCrashBugreport = true;
            mReportProcessName = processName;
          }
        }
        return !mKillProcessAfterError;
      }
      return false;
    }
示例#2
0
  /**
   * Enables strict mode. This should only be called when debugging the application and is useful
   * for finding some potential bugs or best practice violations.
   */
  @TargetApi(11)
  public static void enableStrictMode() {
    // Strict mode is only available on gingerbread or later
    if (Utils.hasGingerbread()) {

      // Enable all thread strict mode policies
      StrictMode.ThreadPolicy.Builder threadPolicyBuilder =
          new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog();

      // Enable all VM strict mode policies
      StrictMode.VmPolicy.Builder vmPolicyBuilder =
          new StrictMode.VmPolicy.Builder().detectAll().penaltyLog();

      // Honeycomb introduced some additional strict mode features
      if (Utils.hasHoneycomb()) {
        // Flash screen when thread policy is violated
        threadPolicyBuilder.penaltyFlashScreen();
        // For each activity class, set an instance limit of 1. Any more instances and
        // there could be a memory leak.
        /* vmPolicyBuilder
        .setClassInstanceLimit(ContactActivity.class, 1);*/
      }

      // Use builders to enable strict mode policies
      StrictMode.setThreadPolicy(threadPolicyBuilder.build());
      StrictMode.setVmPolicy(vmPolicyBuilder.build());
    }
  }
    public int appNotResponding(String processName, int pid, String processStats) {
      if (mVerbose > 0) {
        StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskWrites();
        System.err.println("// NOT RESPONDING: " + processName + " (pid " + pid + ")");
        System.err.println(processStats);
        StrictMode.setThreadPolicy(savedPolicy);
      }

      synchronized (Monkey.this) {
        mRequestAnrTraces = true;
        mRequestDumpsysMemInfo = true;
        mRequestProcRank = true;
        if (mRequestBugreport) {
          mRequestAnrBugreport = true;
          mReportProcessName = processName;
        }
      }
      if (!mIgnoreTimeouts) {
        synchronized (Monkey.this) {
          mAbort = true;
        }
        return (mKillProcessAfterError) ? -1 : 0;
      }
      return 0;
    }
示例#4
0
  @SuppressLint("NewApi")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    Log.i("TAG", "------------------------ Restart");
    // LocationManager locationManager = (LocationManager)
    // getSystemService(Context.LOCATION_SERVICE);
    // LocationProvider locationProvider =
    // locationManager.getProvider(LocationManager.NETWORK_PROVIDER);
    // Or, use GPS location data:
    // LocationProvider locationProvider = LocationManager.GPS_PROVIDER;

    StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork()
            .penaltyLog()
            .build());
    StrictMode.setVmPolicy(
        new StrictMode.VmPolicy.Builder()
            .detectLeakedSqlLiteObjects()
            .detectLeakedClosableObjects()
            .penaltyLog()
            .penaltyDeath()
            .build());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_loading);
    progressBar = (ProgressBar) findViewById(R.id.progressBar1);
    textView = (TextView) findViewById(R.id.textView1);
    textView.setText(R.string.application_name);
    ReadJson readJson = new ReadJson();
    readJson.execute();
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    if (MyApplication.debug) {
      StrictMode.setThreadPolicy(
          new StrictMode.ThreadPolicy.Builder()
              .detectDiskReads()
              .detectDiskWrites()
              .detectNetwork() // or .detectAll() for all detectable problems
              .penaltyLog()
              .build());
      StrictMode.setVmPolicy(
          new StrictMode.VmPolicy.Builder()
              .detectLeakedSqlLiteObjects()
              // .detectLeakedClosableObjects()
              .penaltyLog()
              .penaltyDeath()
              .build());
    }

    super.onCreate(savedInstanceState);
    MyApplication.getInstance().getSettings().registerOnSharedPreferenceChangeListener(this);
    setLanguage();
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
  }
  /**
   * Use strict mode to determine app bottlenecks.
   *
   * <p>Does nothing if api version is less than 11.
   */
  @TargetApi(11)
  private static void initStrictMode() {

    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.HONEYCOMB) {
      return;
    }

    StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder()
            .detectCustomSlowCalls()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork()
            .penaltyLog()
            .penaltyFlashScreen()
            .build());

    try {
      StrictMode.setVmPolicy(
          new StrictMode.VmPolicy.Builder()
              .detectLeakedSqlLiteObjects()
              .detectLeakedClosableObjects()
              .setClassInstanceLimit(Class.forName(PlaybackService.class.getName()), 1)
              .penaltyLog()
              .build());
    } catch (ClassNotFoundException e) {
      Log.e(TAG, e.toString());
    }
  }
  private String readFile(String file, char endChar) {
    // Permit disk reads here, as /proc/meminfo isn't really "on
    // disk" and should be fast.  TODO: make BlockGuard ignore
    // /proc/ and /sys/ files perhaps?
    StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskReads();
    FileInputStream is = null;
    try {
      is = new FileInputStream(file);
      int len = is.read(mBuffer);
      is.close();

      if (len > 0) {
        int i;
        for (i = 0; i < len; i++) {
          if (mBuffer[i] == endChar) {
            break;
          }
        }
        return new String(mBuffer, 0, i);
      }
    } catch (java.io.FileNotFoundException e) {
    } catch (java.io.IOException e) {
    } finally {
      IoUtils.closeQuietly(is);
      StrictMode.setThreadPolicy(savedPolicy);
    }
    return null;
  }
 private static void tryObtainingDataDirLockOrDie() {
   StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
   StrictMode.allowThreadDiskWrites();
   try {
     String dataPath = PathUtils.getDataDirectory(ContextUtils.getApplicationContext());
     File lockFile = new File(dataPath, EXCLUSIVE_LOCK_FILE);
     boolean success = false;
     try {
       // Note that the file is not closed intentionally.
       RandomAccessFile file = new RandomAccessFile(lockFile, "rw");
       sExclusiveFileLock = file.getChannel().tryLock();
       success = sExclusiveFileLock != null;
     } catch (IOException e) {
       Log.w(TAG, "Failed to create lock file " + lockFile, e);
     }
     if (!success) {
       Log.w(
           TAG,
           "The app may have another WebView opened in a separate process. "
               + "This is not recommended and may stop working in future versions.");
     }
   } finally {
     StrictMode.setThreadPolicy(oldPolicy);
   }
 }
示例#9
0
 @Override
 public void onCreate() {
   super.onCreate();
   if (Config.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
     StrictMode.setThreadPolicy(
         new StrictMode.ThreadPolicy.Builder().detectAll().penaltyDialog().build());
     StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build());
   }
   sInstance = this;
   initImageLoader(getApplicationContext());
   mPreferences = PreferenceManager.getDefaultSharedPreferences(this);
   mPreferences.registerOnSharedPreferenceChangeListener(this);
   try {
     ViewConfiguration config = ViewConfiguration.get(this);
     Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
     if (menuKeyField != null) {
       menuKeyField.setAccessible(true);
       menuKeyField.setBoolean(config, false);
     }
   } catch (Exception ex) {
     // Ignore
   }
   // 全局异常捕获
   //		CustomException customException = CustomException.getInstance();
   //		customException.init(getApplicationContext());
   initJpush();
 }
示例#10
0
  /** enables "strict mode" for testing - should NEVER be used in release builds */
  @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
  private static void enableStrictMode() {
    // return if the build is not a debug build
    if (!BuildConfig.DEBUG) {
      AppLog.e(T.UTILS, "You should not call enableStrictMode() on a non debug build");
      return;
    }

    StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork()
            .penaltyLog()
            .penaltyFlashScreen()
            .build());

    StrictMode.setVmPolicy(
        new StrictMode.VmPolicy.Builder()
            .detectActivityLeaks()
            .detectLeakedSqlLiteObjects()
            .detectLeakedClosableObjects()
            .detectLeakedRegistrationObjects() // <-- requires Jelly Bean
            .penaltyLog()
            .build());

    AppLog.w(T.UTILS, "Strict mode enabled");
  }
  @Override
  public void onCreate() {
    super.onCreate();

    StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().penaltyDialog().build());
    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
  }
示例#12
0
文件: Util.java 项目: gubo/slipwire
 public static void strict() {
   StrictMode.setThreadPolicy(
       new StrictMode.ThreadPolicy.Builder()
           .detectAll()
           .penaltyLog()
           .penaltyFlashScreen()
           .build());
   StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
   DBG.w("STRICT MODE ON");
 }
示例#13
0
 /**
  * Check the cached value to figure out if the feature is enabled. We have to use the cached value
  * because native library may not yet been loaded.
  *
  * @return Whether the feature is enabled.
  */
 private static boolean isEnabledInPrefs() {
   // Will go away once the feature is enabled for everyone by default.
   StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
   try {
     return ChromePreferenceManager.getInstance(ContextUtils.getApplicationContext())
         .getCachedWebApkRuntimeEnabled();
   } finally {
     StrictMode.setThreadPolicy(oldPolicy);
   }
 }
示例#14
0
  /**
   * Return the amount of physical memory on this device in kilobytes.
   *
   * @return Amount of physical memory in kilobytes, or 0 if there was an error trying to access the
   *     information.
   */
  private static int amountOfPhysicalMemoryKB() {
    // Extract total memory RAM size by parsing /proc/meminfo, note that
    // this is exactly what the implementation of sysconf(_SC_PHYS_PAGES)
    // does. However, it can't be called because this method must be
    // usable before any native code is loaded.

    // An alternative is to use ActivityManager.getMemoryInfo(), but this
    // requires a valid ActivityManager handle, which can only come from
    // a valid Context object, which itself cannot be retrieved
    // during early startup, where this method is called. And making it
    // an explicit parameter here makes all call paths _much_ more
    // complicated.

    Pattern pattern = Pattern.compile("^MemTotal:\\s+([0-9]+) kB$");
    // Synchronously reading files in /proc in the UI thread is safe.
    StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
    try {
      FileReader fileReader = new FileReader("/proc/meminfo");
      try {
        BufferedReader reader = new BufferedReader(fileReader);
        try {
          String line;
          for (; ; ) {
            line = reader.readLine();
            if (line == null) {
              Log.w(TAG, "/proc/meminfo lacks a MemTotal entry?");
              break;
            }
            Matcher m = pattern.matcher(line);
            if (!m.find()) continue;

            int totalMemoryKB = Integer.parseInt(m.group(1));
            // Sanity check.
            if (totalMemoryKB <= 1024) {
              Log.w(TAG, "Invalid /proc/meminfo total size in kB: " + m.group(1));
              break;
            }

            return totalMemoryKB;
          }

        } finally {
          reader.close();
        }
      } finally {
        fileReader.close();
      }
    } catch (Exception e) {
      Log.w(TAG, "Cannot get total physical size from /proc/meminfo", e);
    } finally {
      StrictMode.setThreadPolicy(oldPolicy);
    }

    return 0;
  }
示例#15
0
  private void init() {
    StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder()
            .detectDiskReads()
            .detectDiskWrites()
            .detectNetwork()
            .penaltyLog()
            .build());
    StrictMode.setVmPolicy(
        new StrictMode.VmPolicy.Builder()
            .detectLeakedSqlLiteObjects()
            .detectLeakedClosableObjects()
            .penaltyLog()
            .penaltyDeath()
            .build());

    // set toolbar
    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    mToolbar.setTitle("");
    setSupportActionBar(mToolbar);
    TextView tvv = (TextView) findViewById(R.id.titlefortoolbar);
    tvv.setText("评价");

    // 添加按钮事件
    /*Button button  =(Button)findViewById(R.id.button_comment_send);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Toast.makeText(getApplicationContext(), "通过setOnClickListener()方法实现",
                    Toast.LENGTH_SHORT).show();
            //Intent intent = new Intent(activity_comment.this, activity_home.class);
            //activity_comment.this.startActivity(intent);
        }
    });*/
    RatingBar ratBar = (RatingBar) findViewById(R.id.ratingBar);
    ratBar.setStepSize(1); // 步进为1
    ratBar.setOnRatingBarChangeListener(
        new RatingBar.OnRatingBarChangeListener() {
          @Override
          public void onRatingChanged(RatingBar ratingBar, float rating, boolean fromUser) {
            // doing actions
            starnum = (int) rating;
            // rating是传入的星级。
          }
        });

    // FAB
    fab();

    sp = this.getSharedPreferences("user_id", MODE_PRIVATE);
    user_id = sp.getInt("user_id", -1);
  }
示例#16
0
  @TargetApi(VERSION_CODES.HONEYCOMB)
  public static void enableStrictMode() {
    if (Utils.hasGingerbread()) {
      StrictMode.ThreadPolicy.Builder threadPolicyBuilder =
          new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog();
      StrictMode.VmPolicy.Builder vmPolicyBuilder =
          new StrictMode.VmPolicy.Builder().detectAll().penaltyLog();

      StrictMode.setThreadPolicy(threadPolicyBuilder.build());
      StrictMode.setVmPolicy(vmPolicyBuilder.build());
    }
  }
示例#17
0
 public PeepersApplication() {
   super();
   StrictMode.setThreadPolicy(
       new StrictMode.ThreadPolicy.Builder()
           .detectDiskReads()
           .detectDiskWrites()
           .detectNetwork()
           .penaltyLog()
           .build());
   StrictMode.setVmPolicy(
       new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().penaltyLog().build());
 } // constructor()
  private void enableStrictMode() {
    if (DEBUG) {
      final StrictMode.ThreadPolicy.Builder threadPolicyBuilder =
          new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog();
      final StrictMode.VmPolicy.Builder vmPolicyBuilder =
          new StrictMode.VmPolicy.Builder().detectAll().penaltyLog();

      threadPolicyBuilder.penaltyFlashScreen();
      StrictMode.setThreadPolicy(threadPolicyBuilder.build());
      StrictMode.setVmPolicy(vmPolicyBuilder.build());
    }
  }
示例#19
0
  @Override
  public void onCreate() {
    super.onCreate();

    // (严格模式):监视APP相关的运行情况 - 发布应用时关闭此处
    if (PropertiesConfig.getInstance(this).isDeveloper()
        && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
      // 线程检测
      StrictMode.setThreadPolicy(
          new StrictMode.ThreadPolicy.Builder().detectAll().penaltyDialog().build());
      StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build());
    }
  }
示例#20
0
  @Override
  public void onCreate() {
    // TODO Auto-generated method stub
    if (false && Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
      StrictMode.setThreadPolicy(
          new StrictMode.ThreadPolicy.Builder().detectAll().penaltyDialog().build());
      StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyDeath().build());
    }

    super.onCreate();
    context = this;
    Log.e("debug", "commonApplication  is  oncreate");
    ormDateBaseHelper = new OrmDateBaseHelper(this, "cloud_contact", null, 1);
    initImageLoader(getApplicationContext());
  }
示例#21
0
 public static void struct() {
   StrictMode.setThreadPolicy(
       new StrictMode.ThreadPolicy.Builder()
           .detectDiskReads()
           .detectDiskWrites()
           .detectNetwork() // or
           .penaltyLog()
           .build());
   StrictMode.setVmPolicy(
       new StrictMode.VmPolicy.Builder()
           .detectLeakedSqlLiteObjects() //
           .penaltyLog() //
           .penaltyDeath()
           .build());
 }
示例#22
0
 @Override
 public void onCreate() {
   if (BuildConfig.DEBUG) {
     StrictMode.setThreadPolicy(
         new StrictMode.ThreadPolicy.Builder()
             .detectAll()
             .penaltyLog()
             .penaltyFlashScreen()
             .build());
     StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
   } else ACRA.init(this);
   playStoreVariant = BuildConfig.FLAVOR.equals("play");
   super.onCreate();
   refWatcher = LeakCanary.install(this);
 }
示例#23
0
  @SuppressLint("NewApi")
  public static void enableStrictMode() {
    if (Utils.hasGingerbread()) {
      StrictMode.ThreadPolicy.Builder threadPolicyBuilder =
          new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog();
      StrictMode.VmPolicy.Builder vmPolicyBuilder =
          new StrictMode.VmPolicy.Builder().detectAll().penaltyLog();

      if (Utils.hasHoneycomb()) {
        threadPolicyBuilder.penaltyFlashScreen();
        vmPolicyBuilder.setClassInstanceLimit(ImageGridActivity.class, 1);
      }
      StrictMode.setThreadPolicy(threadPolicyBuilder.build());
      StrictMode.setVmPolicy(vmPolicyBuilder.build());
    }
  }
    public JSONObject getJSONFromURL() {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);

      HttpResponse response;
      HttpClient myClient = new DefaultHttpClient();
      HttpPost myConnection = new HttpPost(urlIan);

      try {
        response = myClient.execute(myConnection);
        test = EntityUtils.toString(response.getEntity(), "UTF-8");
        arr = new JSONArray(test);
        strRoot = arr.getJSONObject(0);
        finished = true;

      } catch (IOException e) {
        // Toast.makeText(getApplicationContext(), "error1: "+e.toString(),
        // Toast.LENGTH_LONG).show();
      } catch (JSONException e) {
        // Toast.makeText(getApplicationContext(), "error2: "+e.toString(),
        // Toast.LENGTH_LONG).show();
      }

      startProgressBar();
      return strRoot;
    }
示例#25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    setTitle("codeforces monitor");

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);

    Button refreshButton = (Button) findViewById(R.id.refreshButton);
    refreshButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            updateList();
          }
        });

    Button aboutButton = (Button) findViewById(R.id.aboutButton);
    aboutButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            startActivity(new Intent(MainActivity.this, AboutActivity.class));
          }
        });

    Button listButton = (Button) findViewById(R.id.listButton);
    listButton.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            startActivity(new Intent(MainActivity.this, ListActivity.class));
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    StrictMode.setThreadPolicy(
        new StrictMode.ThreadPolicy.Builder()
            .detectCustomSlowCalls()
            .detectDiskWrites()
            .penaltyDialog()
            .build());

    button = (Button) findViewById(R.id.buttonBlocked);
    button.setOnClickListener(this);

    ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
    co.hideOnClickOutside = true;
    sv =
        ShowcaseView.insertShowcaseView(
            R.id.buttonBlocked,
            this,
            "ShowcaseView Sample",
            "When the ShowcaseView is showing, "
                + "pressing the button will show a gesture. When it is hidden "
                + "it'll go to another Activity.",
            co);
    sv.setOnShowcaseEventListener(this);
  }
示例#27
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // by jmpessoa --- fix for http get
    // ref. http://stackoverflow.com/questions/8706464/defaulthttpclient-to-androidhttpclient
    if (android.os.Build.VERSION.SDK_INT > 9) {
      StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
      StrictMode.setThreadPolicy(policy);
    }

    // Log.i("jApp","01.Activity.onCreate");
    controls = new Controls();
    controls.activity = this;
    controls.appLayout = new RelativeLayout(this);
    controls.appLayout.getRootView().setBackgroundColor(0x00FFFFFF);
    controls.screenStyle = controls.jAppOnScreenStyle();
    switch (controls.screenStyle) {
      case 1:
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        break;
      case 2:
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        break;
      default:; // Device Default , Rotation by Device
    }
    this.setContentView(controls.appLayout);
    this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);

    // Event : Java -> Pascal
    // Log.i("jApp","02.Controls.jAppOnCreate");
    controls.jAppOnCreate(this, controls.appLayout);
  }
示例#28
0
  @SuppressLint("NewApi")
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    StrictMode.ThreadPolicy poly = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(poly);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.changepassword);
    mkc = (EditText) findViewById(R.id.editmkht);
    mkm = (EditText) findViewById(R.id.editmkm);
    lmkm = (EditText) findViewById(R.id.editlmkm);
    btnluu = (Button) findViewById(R.id.btnluu);
    btnluu.setOnClickListener(
        new OnClickListener() {

          public void onClick(View arg0) {
            // TODO Auto-generated method stub
            String mkht = mkc.getText().toString();
            String mkm1 = mkm.getText().toString();
            String lmkm1 = lmkm.getText().toString();
            List<NameValuePair> name = new ArrayList<NameValuePair>();
            name.add(new BasicNameValuePair("MatKhau", mkht));
            name.add(new BasicNameValuePair("MatKhauMoi", lmkm1));
            jSon js = new jSon();
            JSONObject ob =
                js.getJSONFromUrl("http://minh1.comyr.com/new/UpdateMK.php", "POST", name);
            Toast.makeText(getApplicationContext(), "Thành Công!...", Toast.LENGTH_LONG).show();
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_movie_details_page);

    fanart_play = (ImageView) findViewById(R.id.imageViewFanartPlay);
    plot_txt = (TextView) findViewById(R.id.textViewPlot);
    imdb_txt = (TextView) findViewById(R.id.textViewIMDBscore);
    button = (Button) findViewById(R.id.button_start);

    MyOnClickListener Listener = new MyOnClickListener();
    fanart_play.setOnClickListener(Listener);

    Bundle b = getIntent().getExtras();

    fanart_path = b.getString("fanart_path");
    plot = b.getString("plot");
    imdb_score = b.getString("imdb_score");
    movieid = Integer.parseInt(b.getString("movieid"));

    String fanart = "http://192.168.1.128/" + fanart_path;
    plot_txt.setText(plot);
    imdb_txt.setText(imdb_score + "/10");

    Picasso.with(getApplicationContext())
        .load(fanart)
        .transform(new OverlayTransformation())
        .placeholder(R.drawable.fanart_placeholder)
        .error(R.drawable.fanart_placeholder)
        .into(fanart_play);

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
  }
    public boolean activityResuming(String pkg) {
      boolean allow = checkEnteringPackage(pkg) || (DEBUG_ALLOW_ANY_RESTARTS != 0);

      if (mVerbose > 0) {
        StrictMode.ThreadPolicy savedPolicy = StrictMode.allowThreadDiskWrites();
        System.out.println("    // activityResuming(" + pkg + ")");
        if (!allow) {
          System.out.println(
              "    // " + (allow ? "Allowing" : "Rejecting") + " resume of package " + pkg);
        }
        StrictMode.setThreadPolicy(savedPolicy);
      }

      currentPackage = pkg;
      return allow;
    }