フローティングアクティビティ用にカスタムタイトルバーを作成しました。カスタムタイトルのTextViewのテキストをプログラムで変更したいのですが、変更できません。xmlを介してテキストを変更できますが、コードで変更したいと思います。
これは、タイトルバーのtextViewを更新しないlabel.java(フローティングアクティビティ)のコードです。
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.my_title);
TextView label = (TextView)findViewById(R.id.myTitle);
label.setText("Label here code");//not working
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_title);
setContentView(R.layout.label);// as i need this layout for rest of activity
//rest of code
myTitle.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="Label here"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@android:color/white"
/>