Вот мой файл макета
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3">
<WebView
android:id="@+id/document_id"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ProgressBar
android:id="@+id/load_document_progress"
android:layout_width="30dp"
android:layout_gravity="center"
android:layout_height="30dp"
android:visibility="invisible"/>
<Button
android:id="@+id/start_btn"
android:layout_width="90dp"
android:layout_height="30dp"
android:text="@string/start_btn_txt"
android:textStyle="bold"
android:textColor="#000000"
android:layout_gravity="center"
android:visibility="invisible"
android:onClick="updatePresentationId"
android:background="@drawable/border_radius"/>
</FrameLayout>
Это работает. Но когда мне нужно изменить порядок элементов. Я получу ClassCastException. Вот моя трассировка logcat.
А вот мой код Activity
Я получил ошибку в 1-й строке этого метода. Я меняю видимость представлений в onPreExecute и onPostExecute() Asyntask. Пожалуйста, помогите, что я сделал неправильно здесь?
public void getAllViews()
{
**progressBar=(ProgressBar)findViewById(R.id.load_document_progress);**
startButton=(Button)findViewById(R.id.start_btn);
webView=(WebView)findViewById(R.id.document_id);
userName=(TextView)findViewById(R.id.userNameTv);
presentationName=(TextView)findViewById(R.id.presentation_name);
}
когда вы меняете порядок виджетов. Очистите свой проект и соберите его снова.