我的应用程序启动了一个Activity
,它使用两个Fragments
来提供从List
.
启动时,应用程序会读取SQLite
外部存储上的数据库。此外,它还从外部存储上的 xml 文件中收集数据。
一切都很好,很顺利:)
但是由于我正在使用一个抽象类来重用我的细节Fragments
中的代码,所以应用程序开始表现得很奇怪。当我在打开或隐藏细节的情况下从 USB 插入或拔出设备Fragment
时- 应用程序崩溃。
“抱歉,应用程序 xyz 已意外停止。...请重试”
我认为它与细节有关Fragments
。我不确定,因为如果您拔下设备,调试器或日志记录将无法工作:D
但所有其他功能都可以正常工作。
如果拔下设备,应用程序会发生什么?也许我可以干预那里...
抽象细节片段:
public AbstractWISDetailFragment(ChooseData cData) {
this.data = cData;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
setDetail();
view.setClickable(true);
}
protected abstract void setDetail();
实现片段:
public ActorDetailFragment(ChooseData data) {
super(data);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.akteur_detail, container, false);
return view;
}
@Override
protected void setDetail() {
// something
...
}
编辑:
从我触摸列表项以实例化详细片段的那一刻起,这是我的 logcat 条目:
I/InputReader( 305): dispatchTouch::touch event's action is 0, pending(waiting
finished signal)=0
I/InputDispatcher( 305): Delivering touch to current input target: action: 0, c
hannel '41a8fc30 ...ChooseActivity (server)'
I/InputDispatcher( 305): Delivering touch to current input target: action: 0, c
hannel 'TouchIntercepter (server)'
I/InputReader( 305): dispatchTouch::touch event's action is 1, pending(waiting
finished signal)=0
I/InputDispatcher( 305): Delivering touch to current input target: action: 1, c
hannel '41a8fc30 ...ChooseActivity (server)'
I/InputDispatcher( 305): Delivering touch to current input target: action: 1, c
hannel 'TouchIntercepter (server)'
D/WIS_ActorList( 2686): new actor item data set (process reseted)
D/WIS_ChooseActivity( 2686): ProcessButton enabled
D/WIS_ChooseActivity( 2686): ProcessStartButton disabled
D/WIS_ChooseActivity( 2686): ProcessStartButton disabled
D/HierarchicalStateMachine( 305): handleMessage: E msg.what=65619
D/HierarchicalStateMachine( 305): processMsg: ConnectedState
D/WifiStateMachine( 305): ConnectedState{ what=65619 when=-3ms arg1=4 }
D/HierarchicalStateMachine( 305): handleMessage: X
D/HierarchicalStateMachine( 305): handleMessage: E msg.what=65619
D/HierarchicalStateMachine( 305): processMsg: ConnectedState
D/WifiStateMachine( 305): ConnectedState{ what=65619 when=-3ms arg1=4 }
D/HierarchicalStateMachine( 305): handleMessage: X
D/dalvikvm( 2305): GC_EXPLICIT freed 329K, 9% free 6875K/7495K, paused 7ms+2ms
W/PowerManagerService( 305): Timer 0x3->0x3|0x1
D/HierarchicalStateMachine( 305): handleMessage: E msg.what=65619
D/HierarchicalStateMachine( 305): processMsg: ConnectedState
D/WifiStateMachine( 305): ConnectedState{ what=65619 when=-4ms arg1=4 }
D/HierarchicalStateMachine( 305): handleMessage: X
D/HierarchicalStateMachine( 305): handleMessage: E msg.what=65619
D/HierarchicalStateMachine( 305): processMsg: ConnectedState
D/WifiStateMachine( 305): ConnectedState{ what=65619 when=-4ms arg1=4 }
D/HierarchicalStateMachine( 305): handleMessage: X
D/HierarchicalStateMachine( 305): handleMessage: E msg.what=65619
D/HierarchicalStateMachine( 305): processMsg: ConnectedState
D/WifiStateMachine( 305): ConnectedState{ what=65619 when=-4ms arg1=4 }
D/HierarchicalStateMachine( 305): handleMessage: X
如果我拔下设备 logcat 会杀死自己。