Domanda

I want to implement strictMode to make my application faster but whenver I try to import it via:

Import android.os.StrictMode;

It's not available. I've read that strictMode won't work with versions before 2.3.3. This is a problem because the app is designed for 2.2 froyo. Is there a way to make my application go to 2.3.3 and be able to use strictMode?

È stato utile?

Soluzione

the answer is simply you need 2.3.3 to use strict mode so there is no way around that but you can set your application during development to 2.3.3 and when you want to release it set the apilevel back to "8"

as vogella says in his tutorial :

For example the following setup will crash your application if it violates some of the Android policies. StrictMode should only be used during development and not in your live application.

so in the end you only have to remove all the strict mode features as you would normaly have to do anyway

Altri suggerimenti

Read some more about StrictMode here: http://android-developers.blogspot.com/2010/12/new-gingerbread-api-strictmode.html

I haven't used it personally, but you should only use it during development time. So what you can do is target android devices 2.3.3 and higher for the time being just to use the StrictMode, then drop the minimum back down to 2.2.

You MAY be able to set the minimum to 2.2 and set the target android version to 2.3.3, but I am not sure of this and am unable to try it out at the very moment.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top