Paste
Pasted as Java by naresh ( 11 years ago )
for (int i = 0; i < size; i++) {
final AttractionsDTO obj = attractionsList.get(i);
View view = inflater.inflate(R.layout.thumbnail_row, null);
final LinearLayout c view
.findViewById(R.id.llContent);
TextView titleTv = (TextView) view
.findViewById(R.id.attraction_title_text);
spanText = Html.fromHtml(title);
titleTv.setText(spanText.toString().toUpperCase());
iv.setOnClickListener(new OnClickListener() {
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
@Override
public void onClick(View v) {
AttractionsDTO dto = obj;
boolean isSameSelected = false;
AttractionsDTO preDto = myapp.getSelectedAttraction();
if (preDto != null
&& preDto.getId().equalsIgnoreCase(dto.getId())) {
isSameSelected = true;
}
myapp.setSelectedAttraction(dto);
if (!isSameSelected) {
// set the background for selected ones
((Activity) context).getWindow().getDecorView()
.findViewById(R.id.images_linearlayout)
.invalidate();
int sdk = android.os.Build.VERSION.SDK_INT;
if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN)
{
contentLayout.setBackgroundDrawable(context
.getResources().getDrawable(
R.drawable.place_selected_border));
} else {
contentLayout.setBackground(context.getResources()
.getDrawable(
R.drawable.place_selected_border));
}
}
});
view.setId(i);
parentLayout.addView(view);
}
Revise this Paste
Parent: 78169