Skip to content Skip to sidebar Skip to footer

How To Make A Device Freeze?

This is a bit weird question, however, I need this for my project. I am trying to simulate 'out of memory' effect by calling the activity in its own onCreate (this calls the activi

Solution 1:

One solution might be this:

@OverridepublicvoidonReceive(Context context, Intent intent) {
     ArrayList<Bitmap> bitmapArray = newArrayList<Bitmap>();
     finalintTOTAL_BITMAPS=1000; //any large number would work.for(int i=0; i<TOTAL_BITMAPS; i++){
          Bitmapbitmap= BitmapFactory.decodeResource(context.getResources(), R.drawable.large_image); // load a large bitmap from drawable..
          bitmapArray.add(bitmap);
     }
}

Solution 2:

Create this method

privatevoidstackOverFlow()
{
    this.stackOverFlow();
}

Then call this method whenever you want your app to freeze.

Post a Comment for "How To Make A Device Freeze?"