0
I want to upload images from the URL with the universal image:
java.lang.Noclassdeffounderror: com.nostra13.universalimageloader.core.Imageloaderconfiguration$Builder
I already downloaded the lib, and set up.
My Adapter:
public class AdapterEmpresa extends BaseAdapter {
private LayoutInflater mInflater;
private List<Segmento> itens;
ImageLoader imageLoader;
DisplayImageOptions options;
public AdapterEmpresa(Context context, List<Segmento> itensEmpresa) {
//Itens que preencheram o listview
super();
this.itens = itensEmpresa;
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).build();
imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
options = new DisplayImageOptions.Builder()
.cacheInMemory()
.cacheOnDisc()
.build();
//responsavel por pegar o Layout do item.
mInflater = LayoutInflater.from(context);
}
/**
* Retorna a quantidade de itens
*
* @return
*/
public int getCount() {
return itens.size();
}
/**
* Retorna o item de acordo com a posicao dele na tela.
*
* @param position
* @return
*/
public Segmento getItem(int position) {
return itens.get(position);
}
/**
* Sem implementação
*
* @param position
* @return
*/
public long getItemId(int position) {
return position;
}
public View getView(int position, View view, ViewGroup parent) {
//Pega o item de acordo com a posção.
LinearLayout row = (LinearLayout)view;
Segmento item = itens.get(position);
//infla o layout para podermos preencher os dados
view = mInflater.inflate(R.layout.empresa_item, null);
//atravez do layout pego pelo LayoutInflater, pegamos cada id relacionado
//ao item e definimos as informações.
final ImageView iconImg = (ImageView)row.findViewById(R.id.imagemSegmento);
TextView nome = (TextView)row.findViewById(R.id.nomeEmpresa);
TextView subtitulo = (TextView)row.findViewById(R.id.subtitulo);
final ProgressBar indicator = (ProgressBar)row.findViewById(R.id.progress);
indicator.setVisibility(View.VISIBLE);
iconImg.setVisibility(View.INVISIBLE);
ImageLoadingListener listener = new ImageLoadingListener(){
@Override
public void onLoadingCancelled(String arg0, View arg1) {
// TODO Auto-generated method stub
}
@Override
public void onLoadingComplete(String arg0, View arg1, Bitmap arg2) {
indicator.setVisibility(View.INVISIBLE);
iconImg.setVisibility(View.VISIBLE);
}
@Override
public void onLoadingFailed(String arg0, View arg1, FailReason arg2) {
// TODO Auto-generated method stub
}
@Override
public void onLoadingStarted(String arg0, View arg1) {
// TODO Auto-generated method stub
}
};
imageLoader.displayImage(getItem(position).getImagem(), iconImg,options, listener);
//Set the relavent text in our TextViews
nome.setText(getItem(position).getNome());
subtitulo.setText(getItem(position).getSubtitulo());
return row;
}
I’m calling the Adapter like this:
adapterEmpresa = new AdapterEmpresa(EmpresaView.this, itensEmpresa);
passing only the list, because the image string is already in the list.
Does anyone know what it can be?
Put the jar in the folder libs of your project or just added to your Buildpath? You’re using the Eclipse?
– Wakim
only in Buildpath, yes eclipse
– War Lock
Then you need to include this jar in the libs folder at the root of your project. Otherwise it won’t be included in apk, causing this problem.
– Wakim
now from nullPointException, know what can be?
– War Lock
could solve, it was because I put Linearlayout there in the code, and the correct one was relative, vlw
– War Lock