public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); setTitle("My App Title"); // rest of the code } }
public class ExampleActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_example); setTitle(R.string.example_title); // rest of the code } }This code sets the title of ExampleActivity using a resource ID instead of a string literal to retrieve the title string from a strings.xml resource file. The package library for this resource would be something like com.example.myapp. In general, the package library for Android app resources will depend on the package name and structure of the app project, which can be configured in the app's build.gradle file.