一个用户将设备升级到Android 8.1,升级后我的应用无法启动。我发现她的设备型号和Android版本存在例外。恳求有助于理解为什么在某些设备上的Android 8.1上会发生此异常。我在Android 8.1上尝试了模拟器-没问题。详细信息如下:
Fatal Exception: java.lang.StackOverflowError: stack size 8MB
at android.widget.ProgressBar.doRefreshProgress(ProgressBar.java:1294)
at android.widget.ProgressBar.refreshProgress(ProgressBar.java:1353)
at android.widget.ProgressBar.setProgressInternal(ProgressBar.java:1418)
at android.widget.ProgressBar.setProgress(ProgressBar.java:1385)
at com.app.my.BarControllerView.updateCurrentSoundValue(Unknown Source:9)
at com.app.my.BarControllerView.makeControllerView(Unknown Source:25)
at com.app.my.BarControllerView.onProgressChanged(Unknown Source:10)
BarController的一些代码(在视频界面顶部显示为弹出窗口)。我想问题在于显示BarControllerView和更新ProgressBar级别的循环。
private void initControllerView(View v) {
int volume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
seekbar = (SeekBar) v.findViewById(R.id.seekBar);
seekbar.setOnSeekBarChangeListener(this);
seekbar.setMax(audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC));
seekbar.setProgress(volume);
}
public void updateCurrentSoundValue() {
seekbar.setProgress(audioManager.getStreamVolume(AudioManager.STREAM_MUSIC));
}
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
try {
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0);
}
catch (Exception e) {
Toast.makeText(mContext, "Error)", Toast.LENGTH_SHORT).show();
}
show(sDefaultTimeout);
}
public void show(int timeout) {
if (!mShowing && mAnchor != null) {
FrameLayout.LayoutParams tlp = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.MATCH_PARENT,
Gravity.RIGHT | Gravity.TOP
);
mAnchor.addView(this, tlp);
mShowing = true;
}
updateCurrentSoundValue();
Message msg = mHandler.obtainMessage(FADE_OUT);
if (timeout != 0) {
mHandler.removeMessages(FADE_OUT);
mHandler.sendMessageDelayed(msg, timeout);
}
}
答案 0 :(得分:0)
newdata_1