0

I have a sample application(Ex:MainApplication) and added into that a library as module dependency(LoginInvokeApplication).

I'm able to access the resources of library from the application.

My question is how can I access the class name and layout of an activity in the application inside my library. I couldn't add the application's package name/application's activity name in library's manifest also.

Help me with some guidance to access resources & classes in my library's activity

Devika
  • 11
  • 4
  • this is the worst architectural deciscion I ever seen – injecteer Jul 22 '16 at 11:03
  • There is a need for me to do. Because I have all my common features in my library. So, once done inheriting a feature and gets success I must move on to my activity of main application – Devika Jul 22 '16 at 11:05
  • 1
    http://stackoverflow.com/questions/18160918/start-activity-android-with-class-name – injecteer Jul 22 '16 at 11:11
  • But I'm in need to access that activity's layout from my library activity. – Devika Jul 22 '16 at 11:40
  • @Override public void setContentView(@LayoutRes int layoutResID) { if (sharedpreferences.contains("username") && sharedpreferences.contains("password")) { super.setContentView(com.example.devika.Mainapplication.MainActivity.R.layout.client_main); } else { super.setContentView(R.layout.activity_logininvoke); initializeViews(); } } – Devika Jul 22 '16 at 11:43
  • Is there any way to access its layout? – Devika Jul 22 '16 at 11:44
  • you can only use reflection to get a hold on a class or static resource like layout, which is not available at compile time of your library. `intent.setComponent(new ComponentName("your.pkg", "your.pkg.YourClass"));` is a short-cut to get an activity – injecteer Jul 22 '16 at 11:58

0 Answers0