Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the title programmatically

Tags:

android

How can I set the current view title(by title I mean the text shown below battery & time(in the image below that would be "Menu Sample") programmatically? I found many examples using manifest file but none from code.

Android Set Title Programatically

like image 201
Caner Avatar asked Aug 05 '11 09:08

Caner


2 Answers

Activity.setTitle() - setTitle("My New Awesome Title!");

like image 118
MByD Avatar answered Nov 12 '22 04:11

MByD


Like this

public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        this.setTitle("This is my Title");


    }
like image 8
Rasel Avatar answered Nov 12 '22 04:11

Rasel