2011-02-11 31 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

相關問題