2011-02-11 50 views

回答

4

不,他们不应该被通知更新。市场将一起过滤应用程序,他们将不再能够看到它或接收更新。

如果要添加使用较高的API级别的功能,但不排除更低的API级别的用户,你可以使用一些反射,使这个:

  public static Method getExternalFilesDir;   

      try { 
        Class<?> partypes[] = new Class[1]; 
     partypes[0] = String.class; 
        getExternalFilesDir = Context.class.getMethod("getExternalFilesDir", partypes); 
      } catch (NoSuchMethodException e) { 
        Log.e(TAG, "getExternalFilesDir isn't available in this devices api"); 
      } 

这段代码是说:

内Context.class有我得到了这个方法 getExternalFilesDir(API等级9)

如果所以实例化变量getExternalFilesDir作为对此方法的反射调用,否则将其保留为空。

那么以后你可以简单地做

 // If the user's device is API9 or above 
    if(getExternalFilesDir != null){ 
     // Invoke is basically the same as doing Context.getExternalFilesDir(var1, var2); 
     getExternalFilesDir.invoke(variable1, variable2); 
    } else { 
     // User cannot use this method do something else 
    } 

希望帮助

+0

谢谢,我会尝试了这一点 – 2011-02-11 14:42:31