Murdock1
Ambitioniertes Mitglied
- 7
Hi,
ich hab diese Layout, wenn ich im 2. LinearLayout, die SeekBar vor den beiden ProgressBars mache knallts direkt beim start, lass ich den Code so läuft es wie es muss. Im LogCat steht ich würde ProgressBar als SeekBar casten, was aber mumpitz ist. Was kann das denn sein?
LogCat:
ich hab diese Layout, wenn ich im 2. LinearLayout, die SeekBar vor den beiden ProgressBars mache knallts direkt beim start, lass ich den Code so läuft es wie es muss. Im LogCat steht ich würde ProgressBar als SeekBar casten, was aber mumpitz ist. Was kann das denn sein?
Code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/black"
android:gravity="center|bottom"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_weight="1"
android:layout_height="0dp"
android:layout_marginBottom="@dimen/activity_vertical_margin">
<TextView
android:id="@+id/textViewTags"
android:textColor="@color/darkersilver"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/empty"
android:textAppearance="?android:attr/textAppearanceLarge" >
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ProgressBar
android:id="@+id/progressBarPeakL"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:max="32767"
android:progress="0"
android:progressDrawable="@drawable/peakbar" >
</ProgressBar>
<ProgressBar
android:id="@+id/progressBarPeakR"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:max="32767"
android:progress="0"
android:progressDrawable="@drawable/peakbar">
</ProgressBar>
<SeekBar
android:id="@+id/seekBarVolume"
android:max="100"
android:progress="50"
android:layout_marginBottom="@dimen/activity_vertical_margin"
android:thumb="@drawable/thumb"
android:progressDrawable="@drawable/progress"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</SeekBar>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:background="?android:attr/selectableItemBackground"
android:gravity="center|bottom" >
<Button
android:id="@+id/buttonPlay"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/play"
android:textColor="@color/darkersilver" >
</Button>
<Button
android:id="@+id/buttonPause"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/pause"
android:textColor="@color/darkersilver" >
</Button>
<Button
android:id="@+id/buttonStop"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="@drawable/buttons"
android:text="@string/stop"
android:textColor="@color/darkersilver" >
</Button>
</LinearLayout>
</LinearLayout>
Code:
pgbPeakR = (ProgressBar)layout.findViewById(R.id.progressBarPeakR);
pgbPeakL = (ProgressBar)layout.findViewById(R.id.progressBarPeakL);
skbVolume = (SeekBar)layout.findViewById(R.id.seekBarVolume);
skbVolume.setOnSeekBarChangeListener(this);
Code:
03-20 20:09:33.032: E/AndroidRuntime(22923): FATAL EXCEPTION: main
03-20 20:09:33.032: E/AndroidRuntime(22923): java.lang.ClassCastException: android.widget.ProgressBar cannot be cast to android.widget.SeekBar
03-20 20:09:33.032: E/AndroidRuntime(22923): at de.murdock.droidradio.MainFragment.onCreateView(MainFragment.java:107)
03-20 20:09:33.032: E/AndroidRuntime(22923): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1504)
03-20 20:09:33.032: E/AndroidRuntime(22923): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:942)
Zuletzt bearbeitet: