У меня БОЛЬШАЯ проблема с inflate
и устали.android inflate view findViewById не работает
У меня есть еще один макет в моем приложении это message
:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="369dp"
android:text="New Text"
android:id="@+id/msg"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"/>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2"/>
</LinearLayout>
и когда я пытаюсь изменить текст msg
Это не удалось:
View vw = getLayoutInflater().inflate(R.layout.message, null);
msg = (TextView) vw.findViewById(R.id.msg);
msg.setText("123");
setContentView(R.layout.message);
и приложение не исключение.
Как я могу это исправить?
Greats and Tnx. –