Download expansion files on tablet

前端 未结 7 2150
清酒与你
清酒与你 2021-01-28 02:13

I am making an dictionary for android phones and tablets. I have committed the file on my developer account, and i works like a charm on phone. When i am trying to run the exact

7条回答
  •  庸人自扰
    2021-01-28 03:09

    i have the same problem . i have a lead , though:

    if you search for "setProgress" , you can see that it exists on the file "V11CustomNotification" , which is intended (i think ) for API11+ , which includes honeycomb for the tablets.

    "setProgress" is only available for API14+ , so you get an exception.

    now , the question is , how to fix it ...

    there are 2 ways: 1.check if the method exists on "CustomNotificationFactory" , and if not , return the V3CustomNotification instance.

    2.change the code that calls the "setProgress" method , so that it will work for API11..13 (including).

    in any case , please tell us what you've done (exactly) , so that we could all benefit from it.

    i've chosen fix #1 , since it's easier and i didn't succeed with #2 (i tried) : edit the file , and use there the next code:

    static public DownloadNotification.ICustomNotification createCustomNotification()
    {
      try
      {
        final Class notificationBuilderClass = Class.forName("android.app.Notification$Builder");
        notificationBuilderClass.getDeclaredMethod("setProgress", new Class[] {Integer.TYPE, Integer.TYPE, Boolean.TYPE});
        return new V11CustomNotification();
      }
      catch (final Exception e)
      {
        return new V3CustomNotification();
      }
    }
    

提交回复
热议问题