实习杂记(22)being added, but it already has a parent
来源:互联网 发布:西南大学官网网络教育 编辑:程序博客网 时间:2024/06/06 01:32
06-12 11:39:14.088: E/AndroidRuntime(22713): FATAL EXCEPTION: main
06-12 11:39:14.088: E/AndroidRuntime(22713): Process: com.wust.wpsmyvideoview, PID: 22713
06-12 11:39:14.088: E/AndroidRuntime(22713): java.lang.RuntimeException: view android.widget.FrameLayout{23eba7a6 V.E..... ......I. 0,0-0,0 #7f070001 app:id/mediacontroller_framelayout} being added, but it already has a parent
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.View.assignParent(View.java:13014)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.ViewRootImpl.setView(ViewRootImpl.java:645)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:272)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.wust.view.CopyMyMediaController.show(CopyMyMediaController.java:277)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.wust.view.CopyMyMediaController.show(CopyMyMediaController.java:235)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.wust.view.MyVideoView$2.onPrepared(MyVideoView.java:345)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2812)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.os.Handler.dispatchMessage(Handler.java:102)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.os.Looper.loop(Looper.java:155)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.app.ActivityThread.main(ActivityThread.java:5721)
06-12 11:39:14.088: E/AndroidRuntime(22713): at java.lang.reflect.Method.invoke(Native Method)
06-12 11:39:14.088: E/AndroidRuntime(22713): at java.lang.reflect.Method.invoke(Method.java:372)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
06-12 11:39:14.088: E/AndroidRuntime(22713): Process: com.wust.wpsmyvideoview, PID: 22713
06-12 11:39:14.088: E/AndroidRuntime(22713): java.lang.RuntimeException: view android.widget.FrameLayout{23eba7a6 V.E..... ......I. 0,0-0,0 #7f070001 app:id/mediacontroller_framelayout} being added, but it already has a parent
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.View.assignParent(View.java:13014)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.ViewRootImpl.setView(ViewRootImpl.java:645)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:272)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.wust.view.CopyMyMediaController.show(CopyMyMediaController.java:277)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.wust.view.CopyMyMediaController.show(CopyMyMediaController.java:235)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.wust.view.MyVideoView$2.onPrepared(MyVideoView.java:345)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.media.MediaPlayer$EventHandler.handleMessage(MediaPlayer.java:2812)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.os.Handler.dispatchMessage(Handler.java:102)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.os.Looper.loop(Looper.java:155)
06-12 11:39:14.088: E/AndroidRuntime(22713): at android.app.ActivityThread.main(ActivityThread.java:5721)
06-12 11:39:14.088: E/AndroidRuntime(22713): at java.lang.reflect.Method.invoke(Native Method)
06-12 11:39:14.088: E/AndroidRuntime(22713): at java.lang.reflect.Method.invoke(Method.java:372)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
06-12 11:39:14.088: E/AndroidRuntime(22713): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
这个问题最好的解决办法是:根据view找到父ViewGroup,全部删掉
ViewGroup vg = (ViewGroup) mRoot.getParent();
if(vg!=null){
vg.removeAllViews();
}
mWindowManager.addView(mRoot, lp);
红色的代码是添加的
0 0
- 实习杂记(22)being added, but it already has a parent
- Added View has RecyclerView as parent but view is not a real child. Unfiltered index:0
- RecycleView异常Added View has RecyclerView as parent but view is not a real child. Unfiltered index:0
- RecyclerView 的坑 1 Added View has RecyclerView as parent but view is not a real child. Unfiltered in
- The specified child already has a parent.
- The specified child already has a parent
- Teh specified child already has a parent
- The specified child already has a parent
- The specified child already has a parent
- Your account already has a signing certificate for this machine but it is not present in your keycha
- “The specified child already has a parent”异常分析(由于addView方法产生)
- The specified child already has a parent错误(子只能有一个父)
- Fragment error:The specified child already has a parent.
- The specified child already has a parent错误
- IllegalStateException: The specified child already has a parent问题解决办法
- The specified child already has a parent错误
- AlertDialog异常The specified child already has a parent. ..解决方法
- The specified child already has a parent错误解决办法
- 运维利器:万能的 strace
- memmove函数的实现
- memmove函数实现2
- 创建一个字符串数组,总共5个元素,每个元素最多保存30个字符,写一个函数排序整个数组。
- c语言实现动态顺序表
- 实习杂记(22)being added, but it already has a parent
- 进程通信(管道 单向通信)
- 进程通信 (命名管道 单向通信)
- 进程通信(消息队列)
- bochs配置文件最简单的例子
- 进程通信(信号量)
- 进程通信(共享内存)
- 线程的创建、终止、等待
- RxJava操作符(02-创建操作)