Привет друг Я с помощью универсального загрузчика Изображение к слайду Image С Json Но я не знаю, почему его Давать Недопустимый аргументБросив Runntime Ошибка Использование Универсальный Image Loader Библиотека
Вот мой код Debugger скачок ошибки
if (result != null) {
if (products != null && products.size() != 0) {
mViewPager.setAdapter(new ImageSlideAdapter(
activity, products, HomeFragment.this));
mIndicator.setViewPager(mViewPager);
imgNameTxt.setText(""
+ ((Product) products.get(mViewPager
.getCurrentItem())).getName());
runnable(products.size());
handler.postDelayed(animateViewPager,
ANIM_VIEWPAGER_DELAY);
}
ошибка на
mViewPager.setAdapter(new ImageSlideAdapter(
activity, products, HomeFragment.this));
И вот мой Slideradaptor Класс
public class ImageSlideAdapter extends PagerAdapter {
ImageLoader imageLoader = ImageLoader.getInstance();
DisplayImageOptions options;
private ImageLoadingListener imageListener;
FragmentActivity activity;
List<Product> products;
HomeFragment homeFragment;
public ImageSlideAdapter(FragmentActivity activity, List<Product> products,
HomeFragment homeFragment) {
this.activity = activity;
this.homeFragment = homeFragment;
this.products = products;
options = new DisplayImageOptions.Builder()
.showImageOnFail(R.drawable.ic_error)
.showStubImage(R.drawable.ic_launcher)
.showImageForEmptyUri(R.drawable.ic_empty).cacheInMemory()
.cacheOnDisc().build();
imageListener = new ImageDisplayListener();
}
@Override
public int getCount() {
return products.size();
}
@Override
public View instantiateItem(ViewGroup container, final int position) {
LayoutInflater inflater = (LayoutInflater) activity
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.vp_image, container, false);
ImageView mImageView = (ImageView) view
.findViewById(R.id.image_display);
mImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
/*Bundle arguments = new Bundle();
Fragment fragment = null;
Log.d("position adapter", "" + position);
Product product = (Product) products.get(position);
arguments.putParcelable("singleProduct", product);
// Start a new fragment
fragment = new ProductDetailFragment();
fragment.setArguments(arguments);
FragmentTransaction transaction = activity
.getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.content_frame, fragment,
ProductDetailFragment.ARG_ITEM_ID);
transaction.addToBackStack(ProductDetailFragment.ARG_ITEM_ID);
transaction.commit();*/
}
});
imageLoader.displayImage(
((Product) products.get(position)).getImageUrl(), mImageView,
options, imageListener);
container.addView(view);
return view;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == object;
}
private static class ImageDisplayListener extends
SimpleImageLoadingListener {
static final List<String> displayedImages = Collections
.synchronizedList(new LinkedList<String>());
@Override
public void onLoadingComplete(String imageUri, View view,
Bitmap loadedImage) {
if (loadedImage != null) {
ImageView imageView = (ImageView) view;
boolean firstDisplay = !displayedImages.contains(imageUri);
if (firstDisplay) {
FadeInBitmapDisplayer.animate(imageView, 500);
displayedImages.add(imageUri);
}
}
}
}
}
Пожалуйста, скажите мне, где я делаю Wrong
и Мою LogCat даю мне
02-12 10:54:05.522: E/AndroidRuntime(1195): java.lang.IllegalStateException: ImageLoader must be init with configuration before using
02-12 10:54:05.522: E/AndroidRuntime(1195): at com.nostra13.universalimageloader.core.ImageLoader.checkConfiguration(ImageLoader.java:340)
02-12 10:54:05.522: E/AndroidRuntime(1195): at com.nostra13.universalimageloader.core.ImageLoader.displayImage(ImageLoader.java:179)
02-12 10:54:05.522: E/AndroidRuntime(1195): at com.wie.trandyclothing.services.ImageSlideAdapter.instantiateItem(ImageSlideAdapter.java:89)
02-12 10:54:05.522: E/AndroidRuntime(1195): at com.wie.trandyclothing.services.ImageSlideAdapter.instantiateItem(ImageSlideAdapter.java:1)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.support.v4.view.ViewPager.populate(ViewPager.java:987)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.support.v4.view.ViewPager.populate(ViewPager.java:919)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.support.v4.view.ViewPager.setAdapter(ViewPager.java:447)
02-12 10:54:05.522: E/AndroidRuntime(1195): at com.wie.trandyclothing.HomeFragment$RequestImgTask.onPostExecute(HomeFragment.java:291)
02-12 10:54:05.522: E/AndroidRuntime(1195): at com.wie.trandyclothing.HomeFragment$RequestImgTask.onPostExecute(HomeFragment.java:1)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.os.AsyncTask.finish(AsyncTask.java:631)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.os.AsyncTask.access$600(AsyncTask.java:177)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.os.Handler.dispatchMessage(Handler.java:99)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.os.Looper.loop(Looper.java:137)
02-12 10:54:05.522: E/AndroidRuntime(1195): at android.app.ActivityThread.main(ActivityThread.java:4745)
02-12 10:54:05.522: E/AndroidRuntime(1195): at java.lang.reflect.Method.invokeNative(Native Method)
02-12 10:54:05.522: E/AndroidRuntime(1195): at java.lang.reflect.Method.invoke(Method.java:511)
извините, нет версии исключений TLTR ... вы должны прочитать все исключение, и вы получите то, что не так ... – Selvin