public static String receiverId ;
public class Notifcationadapter extends BaseAdapter {
public static
DataBaseManager dbManager = new DataBaseManager(context);
ArrayList<Notify> notifies;
public Notifcationadapter(Context context, ArrayList<Notify> notifies) {
super();
this.context = context;
this.notifies = notifies;
}
/* private view holder class */
private class ViewHolder {
TextView txtTitle;
TextView txtDesc;
ImageView yesimage;
ImageView noimage;
TextView revresetime;
TextView rejected;
ImageView notificationuserimage;
RelativeLayout relativeLayout;
}
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater mInflater = (LayoutInflater) context
.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
final DataBaseManager dbManager = new DataBaseManager(context);
final String isRead = notifies.get(position).getNotificationIsRead();
final String dateTime = notifies.get(position)
.getNotificationDatetime();
final String desc = notifies.get(position).getNotificationDescrpiton();
final String id = notifies.get(position).getNotificationId();
receiverId = notifies.get(position).getNotificationRecieverID();
((HomeActivity) context).NotifcationRecciverid = notifies.get(position)
.getNotificationRecieverID();
((HomeActivity) context).nOtifcationMessge = notifies.get(position)
.getNotificationDescrpiton();
final String senderId = notifies.get(position)
.getNotificationSenderID();
final String serverId = notifies.get(position)
.getNotificationServerId();
final String status = notifies.get(position).getNotificationStatus();
final String type = notifies.get(position).getNotificationType();
}
}
Это мой код класса адаптера, способный получить значение из базы данных идентификатора приемника. Я хочу передать это значение в другое действие, чтобы я мог сравнивать его, но am получать нулевое значение, когда я перейти на другую:Как передать значение из класса адаптера в активность фрагмента
утра, используя так:
String value =Notifcationadapter.receiverId;
markerOptions.title(datamodel.contactName);
if (datamodel.id
.equals(Notifcationadapter.receiverId)) {
markerOptions
.snippet(((HomeActivity) getActivity()).nOtifcationMessge);
map.addMarker(markerOptions).showInfoWindow();
} else {
markerOptions.snippet(datamodel.phoneNumber);
// Adding marker on the Google Map
map.addMarker(markerOptions);
}
}
этот код я использую для сравнения значения, но здесь я получаю значение нуль идентификатора получателя, пожалуйста, помогите мне предложить, где я делаю неправильно, пожалуйста, скажите мне, как я передам значение от одного к другому
no its coming Dynamic value – user2794306
@ user2794306 Хотя это динамично, вам нужно обрабатывать их по одному, правильно? –
OK давайте попробуем ... – user2794306