2

Why I am facing error at the import android.os.StrictMode?

import android.os.StrictMode; 

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
--->StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);

I have tried to implement a strictmode.java class. strictmode.java taken from here. However, I am facing the imports errors of this.

import android.app.ActivityManagerNative;
import android.app.ApplicationErrorReport;
import com.android.internal.os.RuntimeInit;
import dalvik.system.BlockGuard;

What should I do? Or is there another way to implement in this? I have to implement this in order to run my application on Android 3.0.

nbanic
  • 1,270
  • 1
  • 8
  • 11
Twister
  • 199
  • 3
  • 9
  • 19

1 Answers1

3

StrictMode is available since API level 9.

So make sure your build target is at least API level 9 (Android 2.3.1).

Benito Bertoli
  • 25,285
  • 12
  • 54
  • 61
  • Ohh okay! manage to solve it. I just have to change the build target – Twister Aug 12 '12 at 13:38
  • If i just put this code under all activity will it work? Going to run on android 3.1.`public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); --->StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy);` – Twister Aug 12 '12 at 13:47