آموزش های این وب سایت به صورت رایگان در دسترس است. اطلاعات بیشتر
بروز خطا
   [message]
اشتراک در سوال
رای ها
[dataList]

مشکل با پروژه آندروید مارکت

هادی بی غم  10 سال پیش  10 سال پیش
0 0

سلام ، پروژه مارکت کپی پروژه استاد انجام دادم اما وقتی روی لیست ویوو کلیک می کنم که وارد صفحه جزءیات برنامه بشه فقط نارنجی میشه و به حالت عادی بر میگرده مشکل از چی می تونه باشه ؟ 

----  البته با کلیک روی دکمه های sort  و دکمه های دیگه درست میشه و با کلیک روی لیست ویوو به صفحه مورد نظر میره !!!

----  و همینطور زمانی که لوگو ها با اجرای قبلی دانلود شده باشن کلیک روی لیست ویوو درست کار می کنه !!!

 

دلیلش چی می تونه باشه دوستان لطفا راهنماییم کنید ، با تشکر

 

  package project;

import ir.sobhe_farda.app.R;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.RatingBar;
import android.widget.TextView;


public class AdapterMusic extends ArrayAdapter<StructMusic> {

public static HashMap<ImageView, String> imageMap = new HashMap<ImageView, String>();


public AdapterMusic(ArrayList<StructMusic> array) {
super(G.context, R.layout.adapter_music, array);

}


private static class ViewHolder {

public ViewGroup layoutRoot;
public TextView txtName;
public TextView txtSinger;
public TextView txtType;
public ImageView imgLogo;
public RatingBar rating;


public ViewHolder(View view) {
layoutRoot = (ViewGroup) view.findViewById(R.id.layoutRoot);
txtName = (TextView) view.findViewById(R.id.txtName);
txtSinger = (TextView) view.findViewById(R.id.txtSinger);
txtType = (TextView) view.findViewById(R.id.txtType);
imgLogo = (ImageView) view.findViewById(R.id.imgLogo);
rating = (RatingBar) view.findViewById(R.id.rating);
}


public void fill(final ArrayAdapter<StructMusic> adapter, final StructMusic item, final int position) {
txtName.setText(item.name);
txtSinger.setText("از " + item.singer);
txtType.setText(item.type);
rating.setRating(item.ratingValue);

String filename = HelperString.getFileName(item.logoUrl);
File imageFile = new File(G.DIR_FINAL + "/" + filename);
if ( !imageFile.exists()) {
imgLogo.setImageBitmap(null);

MyDownloadManager.addToDownloadList(item.logoUrl, imgLogo);
return;
}
BitmapFactory.Options options = new BitmapFactory.Options();
//options.inSampleSize = 32;
Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath(), options);
imgLogo.setImageBitmap(bitmap);
layoutRoot.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
G.selectedMusic = item;
Intent intent = new Intent(G.currentActivity, ActivityMusicDetail.class);
G.currentActivity.startActivity(intent);

}
});

}

}


@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder;

StructMusic item = getItem(position);
if (convertView == null) {
convertView = G.inflater.inflate(R.layout.adapter_music, parent, false);
holder = new ViewHolder(convertView);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}

holder.fill(this, item, position);

return convertView;

}
}


+1 0
کدتون حتما ایرادی داره ، خطا های برنامه و قسمتی که مربوط به بازکردن اکتیویتی جدید هست رو قرار بدید . (10 سال پیش)
0 0
برنامه خطایی نمیده آقای کاشی زاده کد قسمت StructMusic میذارم الان ، من به جای اسم Application کلمه Music گذاشتم کل کلاس ها و فیلدها و ... (10 سال پیش)
0 0
ببخشید کد های کلاس AdapterMusic ، توی نظر بالا به اشتباه نوشتم StructMusic (10 سال پیش)
 برای این سوال 1 پاسخ وجود دارد. مشاهده پاسخ صحیح
پاسخ به سوال 
هادی بی غم  10 سال پیش
0 0

 پاسخ صحیح
0 0
به نظرم فایل xml یه مشکلاتی داره تو سایتهای انگلیسی زبان یه سری چیزا نوشته بودن که اضافه کنیم به کد xml که قابلیت کلیک پذیری از لایه های فرزند گرفته بشه اون کار هم انجام دادم هیچ تغییری نکرد (10 سال پیش)
+1 0
درست شد مشکل فقط یه final بود که نذاشته بودم (10 سال پیش)

پاسخگویی و مشاهده پاسخ های این سوال تنها برای اعضای ویژه سایت امکان پذیر است .
چنانچه تمایل دارید به همه بخش ها دسترسی داشته باشید میتوانید از این بخش لایسنس این آموزش را خریداری نمایید .