how to know the calling activity in android

后端 未结 7 402
余生分开走
余生分开走 2020-11-29 11:59

I have an activity which is called by few other activities. For example: I have Activity1,Activity2,Activity3. Activity1 calls Activity2 and pass parameter. Activity3 also c

相关标签:
7条回答
  • 2020-11-29 12:36

    I'm Using This line

        if (((((ActivityManager) getSystemService(Context.ACTIVITY_SERVICE)).getRunningTasks(1).get(0).baseActivity)).compareTo(new ComponentName(getPackageName()
                        , AnyActivityWantToCheck.class.getName())) == 0){
    // do somthing .....
        }
    

    i hope it work with you

    0 讨论(0)
提交回复
热议问题