I am using only one project to port lite and full versions for that I am just updating Manifest file package names.
My project structure is like this
My App
|_src
|_com.example.myapp
|_MyClass.java
and my Manifest package name is different.
package="com.example.myapplite"
I am using one library project in that I want package names of classes that I am using in MyApp.
I have used this
System.out.println("Package Name " + context.getPackageName());
But its giving me a Manifest file package name value ie. com.example.myapplite
I want MyClass.java package name. ie. com.example.myapp
Also I am aware about this
MyClass mClass = new MyClass();
Package pack = mClass.getClass().getPackage();
But I can't use this approach because I am using following approach to get class file in my library project
Class c = Class.forName("package_name.MyClass");
How to get package name of MyClass.java file programmatically?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…