0

I'm currently working on an app that deals with customer records. The app is fully functional but there is a class within the MainActivity which contains a code that validates the app etc.

I wanted to know if it's possible to remove this class from MainActivity completely and load it dynamically from URL?

Example: OnCreate it gets the class from URL.

Mr V
  • 9
  • 4
  • Why would you want to do that? – Nongthonbam Tonthoi Sep 30 '16 at 12:16
  • 1
    @Piyush False. [You can dinamically load classes in Android](http://android-developers.blogspot.com.br/2011/07/custom-class-loading-in-dalvik.html) based on anything that can be represented as an `Object`. Or even another related question: [How to load a Java class dynamically on android/dalvik?](http://stackoverflow.com/questions/3022454/how-to-load-a-java-class-dynamically-on-android-dalvik) – Bonatti Sep 30 '16 at 12:20
  • I knew that !! We can load from that ! If we want to access in `onCreate()` method then we can sure ! – Piyush Sep 30 '16 at 12:21
  • @NongthonbamTonthoi -Because it contains a code that validates the app and prevents it from being misused. – Mr V Sep 30 '16 at 12:23
  • @Bonatti THANK YOU :D – Mr V Sep 30 '16 at 12:26
  • @Piyush thank you for clarifying! :D I don't know how to edit my question, but is it possible to load the CODE dynamically rather than the class? – Mr V Sep 30 '16 at 12:27
  • Under your question, there are buttons `share` `edit` `close` `delete` `flag` etc... use them to alter the content, but do not "erase" your question, since this site works by having a large repository of questions and answer, for new users to search/lean. Also, you might want to read [this (how to ask)](http://stackoverflow.com/help/how-to-ask) and [this (mcve)](http://stackoverflow.com/help/mcve), as those will help you get more and better answers from the community. – Bonatti Sep 30 '16 at 12:48

1 Answers1

0

for working with url you have work inside AsyncContext because MainActivity does not allow to use url directly for accessing external resource. so for asynchronous processing you have to use AsyncContext that shall help to access external resource by url for example.