Je suis actuellement confronté à un problème concernant les fragments. Comme vous le savez que dans la méthode du fragment, la première instruction est l'appel à la méthode de la superclasse onViewCreated() onViewCreated():L'appel à la méthode onViewCreated() de la superclasse n'est pas exécuté dans la méthode onViewCreated() du fragment
super.onViewCreated(view, savedInstanceState);
Cependant, l'énoncé ci-dessus n'est pas exécutée et à cause de cela, le code en dessous de cette instruction n'est pas exécuté du tout et mon application continue de se bloquer. Je n'ai aucune idée de comment résoudre ce problème. Toute sorte d'aide sera vraiment appréciée.
Merci d'avance!
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 Sortie:
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
Vous avez raison? il pourrait ne pas être exécuté. c'est ListFragment et non Fragment. ListFragment a peut-être remplacer cette méthode. vous devez remplacer les méthodes de la première super classe. qui est ListFragment dans votre cas. –
S'il y a un plantage, il y a une exception stacktrace dans logcat que vous devriez inclure dans votre question. Aussi, comment savez-vous que le code n'est pas exécuté? – laalto
S'il vous plaît poster le logCat! – lionscribe