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);
}
![](http://tiebapic.baidu.com/forum/w%3D580/sign=187081e7c33f8794d3ff4826e21a0ead/79c405b30f2442a753069ffac643ad4bd01302fe.jpg?tbpicau=2024-07-03-05_a1167f173ca7cfaac6adff741f620979)
在java中object 类中有一个getClass方法 但是c#中没有这个方法
还有在java中getDeclaredMethod方法的参数为这两个getDeclaredMethod("setMessageCount", int.class);
![](http://tiebapic.baidu.com/forum/w%3D580/sign=bd94e3e09b5494ee87220f111df4e0e1/2b2a6681800a19d8f274e65a24fa828ba71e468b.jpg?tbpicau=2024-07-03-05_e84b6497ad39752c96823d1381f0c65c)
c# 没有getclass方法 c#的object类里面 连一个class 返回值类型的方法都没有
而且 在c#中 也没有getDeclaredMethod方法 也没有找到替代品 呜呜呜~~~
还有int.class 这个参数c#中该怎么写呢 球球各位带佬了
![](https://tb2.bdstatic.com/tb/editor/images/face/i_f09.png?t=20140803)
砰砰砰
![](https://tb2.bdstatic.com/tb/editor/images/face/i_f09.png?t=20140803)
![](https://tb2.bdstatic.com/tb/editor/images/face/i_f28.png?t=20140803)
遇到了关于小米系列手机的角标适配问题
下面是通过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);
}
![](http://tiebapic.baidu.com/forum/w%3D580/sign=187081e7c33f8794d3ff4826e21a0ead/79c405b30f2442a753069ffac643ad4bd01302fe.jpg?tbpicau=2024-07-03-05_a1167f173ca7cfaac6adff741f620979)
在java中object 类中有一个getClass方法 但是c#中没有这个方法
还有在java中getDeclaredMethod方法的参数为这两个getDeclaredMethod("setMessageCount", int.class);
![](http://tiebapic.baidu.com/forum/w%3D580/sign=bd94e3e09b5494ee87220f111df4e0e1/2b2a6681800a19d8f274e65a24fa828ba71e468b.jpg?tbpicau=2024-07-03-05_e84b6497ad39752c96823d1381f0c65c)
c# 没有getclass方法 c#的object类里面 连一个class 返回值类型的方法都没有
而且 在c#中 也没有getDeclaredMethod方法 也没有找到替代品 呜呜呜~~~
还有int.class 这个参数c#中该怎么写呢 球球各位带佬了
![](https://tb2.bdstatic.com/tb/editor/images/face/i_f09.png?t=20140803)
砰砰砰
![](https://tb2.bdstatic.com/tb/editor/images/face/i_f09.png?t=20140803)
![](https://tb2.bdstatic.com/tb/editor/images/face/i_f28.png?t=20140803)