작업 (작업 탭을 사용하여 조각 만들기로 변경)에서 잘 작동 한 코드와 클래스를 복사했습니다. 그러나 조각 (Fragment)에서는 효과가 없습니다. 앱이 좋아지지는 않지만 디스플레이에는 목록이 표시되지 않습니다. 이미 데이터베이스를 검사했는데 제대로 작동했습니다. 하지만 아무것도 내 목록에 표시됩니다. 도와주세요. 아래 코드는 내 코드입니다.사용자 정의 된 ListView가 조각에서 작동하지 않습니다.
ListFragment.java
public class ListFragment extends android.support.v4.app.Fragment {
DBHelper mydb;
SQLiteDatabase db;
Intent retent;
private int amount;
private String date;
private String time;
private String use;
private ListView useList;
private ArrayList<history> histories;
private historyAdapter adapter;
private String checker;
private TextView upperBalance;
private int position=4;
private int onClickPosition;
private int itemcount;
private int amt=0;
public boolean bottomViewActivate = false;
public boolean monthlyActivate = true;
private int bottomViewId =0;
private TextView Arvitor;
private FrameLayout frameArvitor;
private ArrayList<history> historiesBackup;
private int CurrentYearMonthInt=0;
private int CurrentAddBalance=0;
public Calendar c = Calendar.getInstance();
public SimpleDateFormat intform = new SimpleDateFormat("yyMM");
public SimpleDateFormat yearform = new SimpleDateFormat("yyyy");
public SimpleDateFormat monthform = new SimpleDateFormat("MM");
public SimpleDateFormat yearf = new SimpleDateFormat("yy");
int year = Integer.parseInt(yearform.format(c.getTime()));
int month = Integer.parseInt(monthform.format(c.getTime()));
public ListFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_page2, container, false);
year = Integer.parseInt(yearform.format(c.getTime()));
month = Integer.parseInt(monthform.format(c.getTime()));
CurrentYearMonthInt=Integer.parseInt(intform.format(c.getTime()));
mydb = new DBHelper(getActivity());
upperBalance = (TextView)rootView.findViewById(R.id.ListUpView);
if(mydb.numberOfRows()!=0) {
upperBalance.setText(" Current Balance : "+mydb.getRecentBalance()+"won");
}else {
upperBalance.setText(" Balance : 0won");
}
useList=(ListView) rootView.findViewById(R.id.listView);
histories = new ArrayList<history>();
adapter = new historyAdapter(getActivity(), R.layout.listsublayout, histories);
useList.setAdapter(adapter);
getActivity().registerForContextMenu(useList);
histories=mydb.getAllUseList(bottomViewId,bottomViewActivate,monthlyActivate,CurrentYearMonthInt);
itemcount=mydb.numberOfRows();
adapter.notifyDataSetChanged();
return rootView;
}
}