समस्या का विवरण: मैं थंबनेल कि मेरी SQLite डेटाबेस की आबादी के साथ लेख की एक स्क्रॉल करने योग्य सूची बना रहा हूं। आम तौर पर, यह धीमा होने के अलावा "काम कर रहा है":छवियाँ स्थानीय रूप से कैश नहीं किया जा रहा (यूनिवर्सल छवि लोडर का प्रयोग करके) - धीमी छवि लोड समय
छवियां बहुत धीमी गति से लोड होती हैं ... मैंने सोचा था कि "Universal Image Loader" डिवाइस पर छवियों को कैश किया गया है, और इससे उन्हें केवल दृश्य में दिखाई देने लगेगा आप उन्हें पहले ही देख चुके होंगे (या कम से कम उस के करीब)। लेकिन - जब आप ऊपर/नीचे खींचते हैं, तो कोई भी छवियां वहां नहीं होती हैं, फिर 3-5 सेकंड बाद, छवियां पॉप-इन शुरू होती हैं (जैसे कि यह उन्हें फिर से डाउनलोड कर रही है)
मैं थंबनेल की दृश्यता बदल रहा हूं फ्लाई पर बक्से, लेकिन वह बेकार ढंग से काम कर रहा है - वे बदलने के लिए प्रकट नहीं होते हैं - वे बस देखने या नहीं, कोई चमकती या कुछ भी नहीं स्क्रॉल करते हैं। (लेकिन तब छवियां कुछ और सेकंड के लिए प्रकट नहीं होती हैं)।
मैंने स्क्रॉल करने के बाद अपनी PHP स्क्रिप्ट को हटाकर परीक्षण किया है ... जब मैं पिछली जगह पर वापस स्क्रॉल करता हूं, तो छवियां दिखाई नहीं देती हैं - मुझे लगता है कि यह हर बार मेरी PHP स्क्रिप्ट से लोड हो रहा है।
लेकिन the docs के अनुसार: -:
मेरी ArticleEntryAdapter.js
मेरे पास में
विवरण "UsingFreqLimitedMemoryCache (जब कैश आकार सीमा को पार कर जाता है कम से कम अक्सर इस्तेमाल किया बिटमैप हटा दी जाती है) डिफ़ॉल्ट रूप से प्रयोग किया जाता है" :
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
// We need to get the best view (re-used if possible) and then
// retrieve its corresponding ViewHolder, which optimizes lookup efficiency
final View view = getWorkingView(convertView);
final ViewHolder viewHolder = getViewHolder(view);
final Article article = getItem(position);
// Set the title
viewHolder.titleView.setText(article.title);
//Set the subtitle (subhead) or description
if(article.subtitle != null)
{
viewHolder.subTitleView.setText(article.subtitle);
}
else if(article.description != null)
{
viewHolder.subTitleView.setText(article.description);
}
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.displayImage("", viewHolder.thumbView); //clears previous one
if(article.filepath != null && article.filepath.length() != 0) {
imageLoader.displayImage(
"http://img.sltdb.com/processes/resize.php?image=" + article.filepath + "&size=100&quality=70",
viewHolder.thumbView
);
viewHolder.thumbView.setVisibility(View.VISIBLE);
} else {
viewHolder.thumbView.setVisibility(View.GONE);
}
return view;
}
जहां तक छवियां गलत हैं - यह अक्सर नहीं होती है, लेकिन कभी-कभी स्क्रॉलिंग, मैं एक ही छवि के 2 देखूंगा, और जब मैं लेखों को देखता हूं, तो वे सभी संबंधित नहीं होते हैं (यानी वास्तव में एक ही छवि होने का कोई मौका नहीं) तो - मैं इससे दूर स्क्रॉल करता हूं, और पीछे, और यह अब गलत छवि नहीं है।
नोट: मैं जावा/एंड्रॉइड में नया हूं - शायद आपने पहले ही यह देखा है। प्रति टिप्पणी अनुरोध
अधिक कोड:
private View getWorkingView(final View convertView) {
// The workingView is basically just the convertView re-used if possible
// or inflated new if not possible
View workingView = null;
if(null == convertView) {
final Context context = getContext();
final LayoutInflater inflater = (LayoutInflater)context.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
workingView = inflater.inflate(articleItemLayoutResource, null);
} else {
workingView = convertView;
}
return workingView;
}
अद्यतन: मेरे मैनिफ़ेस्ट फ़ाइल है:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
लेकिन कैश फ़ोल्डर मैंने पाया पूरी तरह से खाली है:
mnt
-sdcard
-Android
-data
-com.mysite.news
-cache
-uil-images
'getWorkingView (convertView) क्या है,'? –
@ शेरिफ elKhatib - जोड़ा – Dave