0

I need a function that gets name of caller Class from current activity. In fact, I want to know, how can I get the name of caller class via getClassLoader function.

By the way, here is my previous question, but I didn't get any acceptable answer. here

Community
  • 1
  • 1
MostafaUTD
  • 29
  • 6
  • The answer on that question is correct. You cannot "get the name of caller class via getClassLoader function". You can pass in some identifier via an `Intent` extra. – CommonsWare Aug 18 '16 at 22:57
  • @CommonsWare How can I check whether if the name of class *(which is called)* equals to classA, then do sth? – MostafaUTD Aug 18 '16 at 23:21
  • I do not know what "which is called" means. – CommonsWare Aug 18 '16 at 23:25
  • @CommonsWare All I'm trying to do is getting the name of previous activity in current activity. I want to know the app has come in this activity from which activity? What the name of that activity? – MostafaUTD Aug 18 '16 at 23:34
  • "All I'm trying to do is getting the name of previous activity in current activity" -- then follow the instructions in the answer on your other question. "What the name of that activity?" -- if you mean "what is the simple Java class name of that activity?", call `getClass().getSimpleName()`, and use that for the value of the extra. So, for example, if you are creating the `Intent` in `ActivityA`, `getClass().getSimpleName()` returns the string `"ActivityA"`. – CommonsWare Aug 18 '16 at 23:37
  • Opening a duplicate question is not the way to get a better answer to your original question. You could try cleaning up your original question or adding comments there. You have a perfectly acceptable answer on your original question. – David Wasser Aug 19 '16 at 10:35

0 Answers0