Note that there are some explanatory texts on larger screens.

plurals
  1. POWhile parsing xml to listview cannot display anything on listview
    primarykey
    data
    text
    <p>I have parsed an xml and used them in a listview. But there is a problem. I will write two class here. One of them is <strong>HaberAdapter.java</strong> that my custom adapter class.</p> <pre><code>package haberler; import java.util.Currency; import com.applogist.kusadasibelediyesi.R; import com.nostra13.universalimageloader.core.ImageLoader; import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; import android.content.Context; import android.text.Html; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView.FindListener; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class HaberAdapter extends BaseAdapter implements OnItemClickListener { HaberRSS haberrss = null; private ImageLoader imageloader; Context context; private LayoutInflater inflater = null; public HaberAdapter(Context context,HaberRSS haberrss) { this.context = context; this.haberrss = haberrss; inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); imageloader = ImageLoader.getInstance(); imageloader.init(ImageLoaderConfiguration.createDefault(context)); } @Override public int getCount() { return haberrss.getItems().size(); } @Override public HaberlerItems getItem(int position) { return haberrss.getItems().get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { View vi = convertView; if(convertView == null) vi = inflater.inflate(R.layout.haber_rss_item, null); HaberlerItems currentItem = (HaberlerItems)getItem(position); TextView lblTitle = (TextView) vi.findViewById(R.id.lblTitle); TextView lblDescription = (TextView) vi.findViewById(R.id.lblDescription); ImageView imgHaber = (ImageView) vi.findViewById(R.id.imgHaber); lblTitle.setText(currentItem.getTitle()); lblDescription.setText(currentItem.getDescription()); imageloader.displayImage(currentItem.getImageUrl(), imgHaber); return vi; } @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Toast.makeText(context, String.valueOf(position), Toast.LENGTH_SHORT).show(); } </code></pre> <p>}</p> <p>Items are that I get from </p> <pre><code> public class HaberlerItems { private String title; private String description; private String shortDesc; private String dateAdded; private List&lt;HaberlerImage&gt; imageList; private String imageUrl; public String getImageUrl() { return imageUrl; } public void setImageUrl(String imageUrl) { this.imageUrl = imageUrl; } public List&lt;HaberlerImage&gt; getImageList() { return imageList; } public void setImageList(List&lt;HaberlerImage&gt; imageList) { this.imageList = imageList; } public HaberlerItems() { setTitle(null); setDescription(null); setShortDesc(null); setDateAdded(null); } public void setTitle(String title) { this.title = title; } public String getTitle() { return title; } public void setDescription(String description) { this.description= description; } public String getDescription() { return description; } public String getShortDesc() { return shortDesc; } public void setShortDesc(String shortDesc) { this.shortDesc = shortDesc; } public String getDateAdded() { return dateAdded; } public void setDateAdded(String dateAdded) { this.dateAdded = dateAdded; } </code></pre> <p>}</p> <p>when i execute the app nothing is displaying on listview. In the other words displaying is an empty listview. I cant find the problem. </p> <p>An also <strong>haber_rss_item.xml</strong> is ;</p> <pre><code> &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" &gt; &lt;LinearLayout android:id="@+id/lnMain" android:layout_width="match_parent" android:layout_height="100dip" android:layout_marginBottom="5dip" android:layout_marginLeft="5dip" android:layout_marginRight="5dip" android:layout_marginTop="5dip" android:orientation="vertical" &gt; &lt;LinearLayout android:id="@+id/lnUst" android:layout_width="match_parent" android:layout_height="20dip" android:layout_marginLeft="5dip" android:layout_marginRight="5dip" android:gravity="left|center" &gt; &lt;TextView android:id="@+id/lblTitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:lines="1" android:maxLines="1" android:text="" android:textColor="@color/blue" android:textSize="14sp" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/lnAlt" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginBottom="5dip" android:layout_marginLeft="5dip" android:layout_marginRight="5dip" android:gravity="center" android:weightSum="10" &gt; &lt;LinearLayout android:id="@+id/lnImage" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="3" &gt; &lt;ImageView android:id="@+id/imgHaber" android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="fitXY" &gt; &lt;/ImageView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/lnDescription" android:layout_width="0dip" android:layout_height="match_parent" android:layout_weight="6" &gt; &lt;TextView android:id="@+id/lblDescription" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="2dip" android:layout_marginRight="2dip" android:maxLines="5" android:text="" android:textColor="@color/black" android:textSize="12sp" &gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/lnOk" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" &gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;/ImageView&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload