How to change an application icon programmatically in Android?

前端 未结 10 2171
闹比i
闹比i 2020-11-21 22:33

Is it possible to change an application icon directly from the program?
I mean, change icon.png in the res\\drawable folder.
I would like t

10条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-21 23:14

    To get the solution by Markus working I needed the first Intent so be:

    Intent myLauncherIntent = new Intent(Intent.ACTION_MAIN);
                myLauncherIntent.setClassName(this,  this.getClass().getName());
                myLauncherIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    

提交回复
热议问题