android都是java开发 但是我有个需求需要使用c#开发android
遇到了关于小米系列手机的角标适配问题
下面是通过java实现的小米适配的部分代
public static void PageMIUITest(Notification notification,Context context,int count){
NotificationManager mNotificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
try {
Field field = notification.getClass().getDeclaredField("extraNotification");
Object extraNotification = field.get(notification);
Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class);
method.invoke(extraNotification, count);
} catch (Exception e) {
e.printStackTrace();
}
mNotificationManager.notify(0, notification);
}
在java中object 类中有一个getClass方法 但是c#中没有这个方法
还有在java中getDeclaredMethod方法的参数为这两个getDeclaredMethod("setMessageCount", int.class);
c# 没有getclass方法 c#的object类里面 连一个class 返回值类型的方法都没有
而且 在c#中 也没有getDeclaredMethod方法 也没有找到替代品 呜呜呜~~~
还有int.class 这个参数c#中该怎么写呢 球球各位带佬了
砰砰砰
遇到了关于小米系列手机的角标适配问题
下面是通过java实现的小米适配的部分代
public static void PageMIUITest(Notification notification,Context context,int count){
NotificationManager mNotificationManager = (NotificationManager) context
.getSystemService(Context.NOTIFICATION_SERVICE);
try {
Field field = notification.getClass().getDeclaredField("extraNotification");
Object extraNotification = field.get(notification);
Method method = extraNotification.getClass().getDeclaredMethod("setMessageCount", int.class);
method.invoke(extraNotification, count);
} catch (Exception e) {
e.printStackTrace();
}
mNotificationManager.notify(0, notification);
}
在java中object 类中有一个getClass方法 但是c#中没有这个方法
还有在java中getDeclaredMethod方法的参数为这两个getDeclaredMethod("setMessageCount", int.class);
c# 没有getclass方法 c#的object类里面 连一个class 返回值类型的方法都没有
而且 在c#中 也没有getDeclaredMethod方法 也没有找到替代品 呜呜呜~~~
还有int.class 这个参数c#中该怎么写呢 球球各位带佬了
砰砰砰