У меня возникла ошибка, специфичная для устройства, которая выглядит странно. В моем ArrayAdapter
у меня есть ImageView
и по щелчку ImageView
он переходит к новому Activity
. Все это хорошо работает на моем Samsung S4 (API 19), но на моем Nexus5 (API 22) он сбой без журнала ошибок.Намерение к другому действию в ArrayAdapter - Ошибка на Nexus-5
Это мой код:
FArrayAdapter.java
public FArrayAdapter(Context context, int resourceId, List<Feeds> feedsList) {
super(context, resourceId, feedsList);
this.resourceId = resourceId;
this.context = context;
this.mfeeds = feedsList;
this.inflater = ((Activity) context).getLayoutInflater();
}
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
inflater = ((Activity) context).getLayoutInflater();
convertView = inflater.inflate(resourceId, parent, false);
}
ImageView image1 = (ImageView) view.findViewById(R.id.iv_t_1);
....
final Intent intent = new Intent(context, ZActivity.class);
if (image1 != null) {
image1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
intent.putExtra("SelectedImagePosition", 1);
Log.v("Error","here"); //i can see this log when i click. App crashes soon after.
context.startActivity(intent);
}
});
}
}
где вы инициализирован 'image1'? –
отредактировал..и сделаю это выше – stud91