Swap application label outside Manifest.xml

Asked

Viewed 680 times

-1

I am working on a project that will be a template for various applications. So far everything is being configured via JSON.

Then the question arose: Is it possible to change this node below outside of manifest.xml, using maybe within my Mainactivity.class? Something like a setLabel.

<application
    android:allowBackup="true"
    android:icon="@drawable/icon"
    -> android:label="@string/app_name"
  • Using which build system? Gradle or Ant?

  • I’m using ant.

  • Ah... If it were Gradle, it has an easy solution to the problem. The ADT in Eclipse does not support variants, because with variants fits perfectly in your case. If you can migrate from one look at it.

  • In the ant there is a task to replace text. But I don’t know if it is possible to change the ant of the Eclipse to include it. Have a look at https://ant.apache.org/manual/Tasks/replaceregexp.html. There is a question that gives a clue to modify the build.xml that generates apk, but does not test: http://stackoverflow.com/questions/2464725/does-the-adt-plugin-automatically-create-an-ant-build-file.

1 answer

-4

Use the following command within some method within your class that extends the main Activity:

this.setTitle("Novo título");
  • 2

    This will only change the title of my Activity, but I want you to change the name of the application.

  • In this case will only change the title of Activity and not the application.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.