I am currently faced with a problem regarding fragments. As you know that in the onViewCreated() method of fragment, the first statement is the call to the onViewCreated() method of the superclass:
super.onViewCreated(view, savedInstanceState);
However, the above statement is not executed and because of that, the code below that statement isn't executed at all and my app keeps crashing. I have no idea how to solve this problem. Any kind of help will be really appreciated.
Thanks in advance!
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 Output:
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 '0123456789ABCDEF' not found
I finally found the solution to my problem!
According to the ListFragment info here:
ListFragment has a default layout that consists of a single list view. However, if you desire, you can customize the fragment layout by returning your own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle). To do this, your view hierarchy must contain a ListView object with the id "@android:id/list" (or list if it's in code)
In my view hierarchy, I had a ListView object but instead of giving that object the id: @android: id/list, as described above, I assigned that object a brand new id. Because of this, a run-time exception was being thrown, and the app was crashing every time. Anyways, thank you all who responded immediately and tried to help me :)