I want to display html text and image together within recyclerview but ı guess ı couldnt. when ı used to one button it works. But ı try to use recyclerview it doesnt work. anyone help me? meanwhile ı am too newbie on android. thanks everyone.
public MyViewHolder(View itemView) {
super(itemView);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View position) {
int mposition = getLayoutPosition();
callActivities(mposition);
}
private void callActivities(int mposition) {
if (mposition == 0) {
image.setImageResource(R.drawable.bb);
String htmlAsString = getString(R.string.bb);
Spanned htmlAsSpanned = Html.fromHtml(htmlAsString);
vh= (TextView) findViewById(R.id.vh);
vh.setText(htmlAsSpanned);
((TextView)findViewById(R.id.vh)).setVisibility(View.VISIBLE); ((TextView)findViewById(R.id.baslik)).setVisibility(View.GONE);
} else if (mposition == 1){
image.setImageResource(R.drawable.db);
String htmlAsString = getString(R.string.db);
Spanned htmlAsSpanned = Html.fromHtml(htmlAsString);
vh= (TextView) findViewById(R.id.vh);
vh.setText(htmlAsSpanned);
((TextView)findViewById(R.id.vh)).setVisibility(View.VISIBLE); ((TextView)findViewById(R.id.baslik)).setVisibility(View.GONE);
} else if (mposition == 2){
image.setImageResource(R.drawable.cb);
String htmlAsString = getString(R.string.cb);
Spanned htmlAsSpanned = Html.fromHtml(htmlAsString);
vh= (TextView) findViewById(R.id.vh);
vh.setText(htmlAsSpanned);
((TextView)findViewById(R.id.vh)).setVisibility(View.VISIBLE); ((TextView)findViewById(R.id.baslik)).setVisibility(View.GONE);
} ((TextView)findViewById(R.id.vh)).setVisibility(View.VISIBLE); ((TextView)findViewById(R.id.baslik)).setVisibility(View.GONE);
}
}
});
}
}