title: How to change android application name and icon at runtime?
body: <p>After installing an android app, is it possible to change app icon and name dynamically(at runtime) when you press a button in the app? </p>
  
  <p>This is the code so far..,</p>
  
  <pre><code>getPackageManager().setComponentEnabledSetting(
  
  new ComponentName("com.example.badgemaste", "com.example.badgemaste.MainActivity"),
  
                  PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
  
  
              try {
  getPackageManager().setComponentEnabledSetting(
                             new ComponentName("com.example.badgemaste", "com.example.badgemaste.MainActivity-One"), 
                                                 PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
                              } catch (Exception e) {
                                 //handle
                              }
  </code></pre>
  
  <p>And in the manifest file...</p>
  
  <pre><code> &lt;application
          android:allowBackup="false"
          android:icon="@drawable/ic_launcher"
          android:label="@string/app_name2"
          android:theme="@style/AppTheme" &gt;
          &lt;activity
              android:name="com.example.badgemaste.MainActivity"
              android:label="@string/app_name" 
              android:launchMode="singleTask"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
          &lt;activity-alias
              android:icon="@drawable/ic_laun" 
              android:label="@string/app_name" 
              android:name="com.example.badgemaste.MainActivity-One"
              android:enabled="true"
              android:targetActivity="com.example.badgemaste.MainActivity"&gt;
  
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity-alias&gt; 
  
  
  
      &lt;/application&gt;
  </code></pre>
  
  <p>When I run this code, initially first icon will appear (in drawer and also in action bar) and then after I close the app and re-run it, it will switch to the other icon.</p>
  
  <p>What I want to do is, assign this procedure to a button, that is if I only press that button, icon will change, otherwise no. 
  How can I achieve this??</p>