I am trying to access classes stored under android.telephony
package using reflection but for some classes I am getting ClassNotFoundException
.
Can anyone tell me why some classes can be accessed and some are not even though this classes have same Access Modifier
Ex: public class TelephonyManager
can be accessed using reflection as shown below
try {
Class<?> manager1 = Class.forName("android.telephony.TelephonyManager");
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
public class SubscriptionManager
cannot be accessed using reflection as shown below
try {
Class<?> subscriptionManager = Class.forName("android.telephony.SubscriptionManager");
//Throwing error
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
}
both classes have same package android.telephony
Aucun commentaire:
Enregistrer un commentaire