В настоящее время у меня возникает проблема с фрагментами. Как вы знаете, что в методе onViewCreated() фрагмента, первое утверждение является вызов метода onViewCreated() суперкласса:Вызов метода onViewCreated() для суперкласса не выполняется в onViewCreated() методе фрагмента
super.onViewCreated(view, savedInstanceState);
Однако приведенное выше утверждение не выполняется, и из-за того, код ниже этого утверждения не выполняется вообще, и мое приложение продолжает сбой. Я не знаю, как решить эту проблему. Любая помощь будет действительно оценена.
Заранее благодарен!
public class FragmentAddWatchedTVShow extends ListFragment {
private Activity context;
public void setContext(Activity context) {
this.context = context;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.frag_add_watched_tvshow, container, false);
return view;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
Log.d(AIntroductionScreen.DEBUGTAG, "Entered in onViewCreated");
//The above log statement is executed but after that nothing gets executed
super.onViewCreated(view, savedInstanceState);/***THIS STATEMENT IS NOT EXECUTED***/
/***None of the code below this gets executed***/
String[] optionsString = getResources().getStringArray(R.array.watched_tvshow_options);
List<AddOptionsItem> optionsList = new ArrayList<AddOptionsItem>();
for (int i = 0; i < optionsString.length; i++){
optionsList.add(new AddOptionsItem(optionsString[i]));
}
AdapterAddWatchedTVShow adapter = new AdapterAddWatchedTVShow(context, optionsList);
setListAdapter(adapter);
}
Logcat Выход:
08-29 23:11:22.670 658-658/? E/Sensors: new acc setDelay handle(0),ns(66667000) err! go to hwmsen
08-29 23:11:22.786 658-658/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History>
08-29 23:11:22.788 658-658/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History>
08-29 23:11:22.791 658-658/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History>
08-29 23:11:22.791 658-658/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History>
08-29 23:11:22.832 137-711/? E/AudioMTKHardware: setCommonParameters() still have param.size() = 1, remain param = "screen_state=on"
08-29 23:11:22.876 927-1018/? E/SQLiteLog: (13) statement aborts at 14: [INSERT INTO activity(start_time,duration,session_id,realtime,refer,name) VALUES (?,?,?,?,?,?)]
08-29 23:11:22.903 927-1018/? E/SQLiteDatabase: Error inserting start_time=1472494282752 duration=0 session_id=28b85451-33d5-4962-8778-cebb5dbd5b61 realtime=174770322 refer=com.ibingo.launcher2.Launcher name=com.ibingo.launcher2.Launcher
android.database.sqlite.SQLiteFullException: database or disk is full (code 13)
at android.database.sqlite.SQLiteConnection.nativeExecuteForLastInsertedRowId(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLastInsertedRowId(SQLiteConnection.java:786)
at android.database.sqlite.SQLiteSession.executeForLastInsertedRowId(SQLiteSession.java:788)
at android.database.sqlite.SQLiteStatement.executeInsert(SQLiteStatement.java:86)
at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1494)
at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1364)
at com.tendcloud.tenddata.aw.a(Unknown Source)
at com.tendcloud.tenddata.s.a(Unknown Source)
at com.tendcloud.tenddata.s.b(Unknown Source)
at com.tendcloud.tenddata.s.a(Unknown Source)
at com.tendcloud.tenddata.p.handleMessage(Unknown Source)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:61)
08-29 23:11:22.941 11785-11785/? E/NetworkScheduler.SR: Invalid parameter app
08-29 23:11:22.941 11785-11785/? E/NetworkScheduler.SR: Invalid package name : Perhaps you didn't include a PendingIntent in the extras?
08-29 23:11:22.986 658-658/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History>
08-29 23:11:22.986 658-658/? E/RemoteViews: ANR Warning,RemoteViews can only be used once ,if not ,it may cause ANR in hosts such as Laucher,SystemUI. keys for search <ANR Exception MSG History>
08-29 23:11:23.502 927-1018/? E/CellLocation: create GsmCellLocation
08-29 23:11:33.766 137-7226/? E/AudioMTKHardware: setCommonParameters() still have param.size() = 1, remain param = "screen_state=off"
08-29 23:11:33.870 13321-13464/? E/SQLiteLog: (1) no such table: behavior
08-29 23:11:47.680 658-1100/? E/Sensors: new acc setDelay handle(0),ns(20000000) err! go to hwmsen
08-29 23:11:53.440 927-1018/? E/CellLocation: create GsmCellLocation
08-29 23:12:00.069 13321-13651/? E/SQLiteLog: (1) no such table: behavior
08-29 23:12:17.276 658-673/? E/Sensors: new acc setDelay handle(0),ns(20000000) err! go to hwmsen
01-01 00:00:00.000 0-0/? E/Internal: device 'ABCDEF' not found
Вы правы? он не может быть выполнен. это ListFragment not Fragment. ListFragment может переопределить этот метод. вы должны переопределить методы очень первого суперкласса. который является ListFragment в вашем случае. –
Если произошел сбой, есть исключение stacktrace в logcat, которое вы должны включить в свой вопрос. Кроме того, как вы знаете, код не выполняется? – laalto
Пожалуйста, напишите logCat! – lionscribe