我試圖建立一個Android,我有一個片段Fragment_X
至極讀取服務器的響應(登錄用戶的數據),然後創建一個表。片段「刷新」android
當活動開始時,片段不是第一個顯示。
登錄後,如果我選擇Fragment_X
表不顯示,我不得不再次點擊它,最後出現表格。
有沒有辦法讓它出現在我第一次選擇Fragment_X
?
這裏是我的代碼:
Fragment_X
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_ordini, container, false);
connection = new DBConnection(c.getId(), getContext());
connection.downloadOrdiniUtente();
CookieO cookieO = new CookieO();
File ordini = new File(path);
if (ordini.exists()) {
createTable(cookieO.getOrdini(), v);
}
return v;
}
如果沒有所有其他類的方法,在這裏你還沒有顯示出來,很難知道問題是什麼。請參閱[mcve] –