For classes that cannot be imported, do you know how to use the class path? Java reflection mechanism is used. The following is an example.
The MTK platform extended the telephone interface generated by the android source and added a telephonymanagerex class to support dual-card support:
Class Name: COM. mediatek. telephony. telephonymangerex;
In applications, we can use the Java reflection mechanism to call the interface:
Class clazz = Class. forname ("com. mediatek. telephony. telephonymanagerex ");
Method getinstance = clazz. getdeclaredmethod ("getdefault ");
Object OBJ = getinstance. Invoke (null, null );
Method getimsi = clazz. getdeclaredmethod ("getsubscriberid", Int. Class );
String imsi0 = (string) getimsi. Invoke (OBJ, 0 );
Log. V (TAG, "imsi0 =" + imsi0 );
// In these functions, the input parameters represent the SIM card ID. The values are 0 and 1, indicating the two SIM cards respectively.
You can input parameters in the call method. Invoke ().
For classes that cannot be imported, andrid knows how to use this class in the class path.