Android: How can I get current opened application name on screen

前端 未结 6 1380
花落未央
花落未央 2020-11-28 15:00

Please suggest me how can I get current open application name, even if there is home screen on device then I will find \"Home screen is open\".

6条回答
  •  無奈伤痛
    2020-11-28 15:48

    With this you can get the current application name

     Resources appR = getApplicationContext().getResources(); 
     CharSequence txt = appR.getText(appR.getIdentifier("app_name","string", getApplicationContext().getPackageName()));
     System.out.println(txt+"  APp Name");
    

提交回复
热议问题