Search code examples
javaandroidtimeimportidentification

When i import Settings.System currentTimeMillis isn't working anymore


I used to have this Line of Code:

parameters.put("time",Long.toString(System.currentTimeMillis()));

When i added some new Features, to name it phone identification by AndroidID i had to import following:

import android.provider.Settings;
import android.provider.Settings.System;

after this change, the System.currentTimeMillis() is said to be not resolvable.

Why is this happening and how can i prevent it from doing it?


Solution

  • If you need to access both android.provider.Settings.System and java.lang.System, one or the other will need to be accessed using its fully-qualified name. For example, you can import android.provider.Settings.System as you currently have it, and change your System.currentTimeMillis() call to:

    parameters.put("time", Long.toString(java.lang.System.currentTimeMillis()));