Arama butonu
Bu konudaki kullanıcılar: 1 misafir
1
Cevap
712
Tıklama
0
Öne Çıkarma
ListFragment ListView Hep Boş
C
9 yıl
Çavuş
Konu Sahibi

Arkadaşlar merhaba. Ben SwipeView ve ListFragment kullanarak bir uygulama yapmaya çalışıyorum. Fakat ListFragment içindeki ListView bir türlü dolu görünmüyor. Yardımcı olabilecek biri var mı? Fragment ve Adapter dosylarını aşağıda paylaşıyorum.

SolFrameFragment (ListFragment)

public class SolFrameFragment extends ListFragment implements View.OnClickListener {

private SolFrameAdapter solFrameAdapter;
ArrayList<TitleClass> titleList;

public SolFrameFragment() {
// Required empty public constructor
}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_sol_frame, container, false);
}

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
titleList = new ArrayList<>();

new GetTitleContents().execute();
titleList = MainActivity.titleList;

solFrameAdapter = new SolFrameAdapter(getActivity(), R.layout.solframe_single, titleList);
setListAdapter(solFrameAdapter);
}

@Override
public void onClick(View v) {

}
}


SolFrameAdapter

public class SolFrameAdapter extends ArrayAdapter<TitleClass> {
private final Context context;
private final ArrayList<TitleClass> titleClassList;

public SolFrameAdapter(Context context, int resource, ArrayList<TitleClass> titleClassList) {
super(context, resource);
this.context = context;
this.titleClassList = titleClassList;
}

@NonNull
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TitleHolder holder;
LayoutInflater layoutInflater = ((Activity) context).getLayoutInflater();

if (convertView == null) {
convertView = layoutInflater.inflate(R.layout.solframe_single, parent, false);
holder = new TitleHolder();
holder.titleTV = (TextView) convertView.findViewById(R.id.titleNameTV);
holder.linkTV = (TextView) convertView.findViewById(R.id.titleLinkTV);
holder.todayEntryTV = (TextView) convertView.findViewById(R.id.titleTodayCountTV);
holder.totalEntryTV = (TextView) convertView.findViewById(R.id.titleTotalCountTV);
holder.lastWriterTV = (TextView) convertView.findViewById(R.id.titleLastWriterTV);
holder.firstWriterTV = (TextView) convertView.findViewById(R.id.titleFirstWriterTV);
convertView.setTag(holder);
} else {
holder = (TitleHolder) convertView.getTag();
}

TitleClass titleClass = titleClassList.get(position);

holder.titleTV.setText(titleClass.getTitle());
holder.linkTV.setText(titleClass.getLink());
holder.todayEntryTV.setText(titleClass.getTodayEntry());
holder.totalEntryTV.setText(titleClass.getTotalEntry());
holder.firstWriterTV.setText(titleClass.getFirstWriter());
holder.lastWriterTV.setText(titleClass.getLastWriter());

return convertView;
}

static class TitleHolder {
TextView totalEntryTV;
TextView todayEntryTV;
TextView titleTV;
TextView linkTV;
TextView firstWriterTV;
TextView lastWriterTV;

}
}


Bu da TitleClass

public class TitleClass {
int totalEntry;
int todayEntry;
String title;
String link;
String firstWriter;
String lastWriter;

public TitleClass(int todayEntry, int totalEntry, String link, String title, String firstWriter, String lastWriter) {
this.totalEntry = totalEntry;
this.todayEntry = todayEntry;
this.title = title;
this.link = link;
this.firstWriter = firstWriter;
this.lastWriter = lastWriter;
}

public int getTotalEntry() {
return totalEntry;
}

public int getTodayEntry() {
return todayEntry;
}

public String getTitle() {
return title;
}

public String getLink() {
return link;
}

public String getFirstWriter() {
return firstWriter;
}

public String getLastWriter() {
return lastWriter;
}
}

DH forumlarında vakit geçirmekten keyif alıyor gibisin ancak giriş yapmadığını görüyoruz.

Üye olduğunda özel mesaj gönderebilir, beğendiğin konuları favorilerine ekleyip takibe alabilir ve daha önce gezdiğin konulara hızlıca erişebilirsin.

Üye Ol Şimdi Değil





< Bu mesaj bu kişi tarafından değiştirildi cratec -- 29 Kasım 2016; 21:45:55 >

C
9 yıl
Çavuş
Konu Sahibi

Yok mu yardımcı olabilecek biri?



DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.