当前位置:网站首页>How to get a generic type
How to get a generic type
2022-06-28 12:11:00 【A cup of bitter mustard】
@Override public void loadImage(@NonNull Context context, @Nullable String url, @Nullable Options options, @Nullable ILoaderListener<T> listener) { Type type = listener.getClass().getGenericInterfaces()[0]; // if type yes ParameterizedType Example , Then strong rotation ,ParameterizedType Can get generic types if (type instanceof ParameterizedType) { ParameterizedType pType = (ParameterizedType) type; Type[] types = pType.getActualTypeArguments(); if (types != null && types.length > 0) { Class clazz = (Class) types[0]; try { Log.e("test", types[0].equals(Drawable.class)); Log.e("test", clazz.equals(Drawable.class)); } catch (Exception e) { e.printStackTrace(); } } } }
边栏推荐
- Chendanqi, Fang Fei, guquanquan and Li Bo won the prize, and the list of Sloan research award in 2022 was released
- 【JS】斐波那契数列实现(递归与循环)
- What method is required for word, PDF and txt files to realize full-text content retrieval?
- Open3d manual clipping point cloud
- The default point of this in JS and how to modify it to 2021.11.09
- Difference (one dimension)
- 【C语言】关于scanf()与scanf_s()的一些问题
- SoapUI rookie tutorial
- Django -- MySQL database reflects the mapping data model to models
- Swin, three degrees! Eth open source VRT: a transformer that refreshes multi domain indicators of video restoration
猜你喜欢
Packaging and publishing application of jetpack compose desktop version
建立自己的网站(18)
Ali three sides: what is the difference between using on or where in the left join associated table and the condition
Join hands with cigent: group alliance introduces advanced network security protection features for SSD master firmware
Graphics view framework for QT learning (to realize startup animation)
Day31 JS notes DOM 2021.09.26
[Beijing University of Aeronautics and Astronautics] information sharing for the first and second examinations of postgraduate entrance examination
Unity屏幕截图功能
Is it feasible to be a programmer at the age of 26?
【北京航空航天大学】考研初试复试资料分享
随机推荐
Allez, Meta - Cosme, comme prévu, cette chaleur ne durera pas longtemps.
Packaging and publishing application of jetpack compose desktop version
day28 严格模式、字符串 js 2021.09.22
Is it feasible to be a programmer at the age of 26?
【北京航空航天大学】考研初试复试资料分享
day25 js中的预解析、递归函数、事件 2021.09.16
AcWing 605. Simple product (implemented in C language)
AcWing 606. Average 1 (implemented in C language)
SHA256加密工具类
Map排序工具类
Day39 prototype chain and page fireworks effect 2021.10.13
Dongyuhui, New Oriental and Phoenix Satellite TV
On the output representation of bidirectional LSTM in pytoch
Fruit FL studio/cubase/studio one music host software comparison
Necessary for beginners PR 2021 quick start tutorial, PR green screen matting operation method
建立自己的网站(18)
Leetcode 705. 设计哈希集合
Day30 JS notes BOM and DOM 2021.09.24
day31 js笔记 DOM下 2021.09.26
What is DAPP system development and analytical understanding