i have two page(main activity page and favorites page),i working on the favorites page , i want when the user clicked on my favorite button ,that page will be showed on another activity that called favorites page. so i can catch page that user clicked and can transfer that value to another activity(means favorites page) with SharedPreferences, but in favorites page i can set visibility my gone textview. below code worked for me but only one textview only visible for me , for example when btn1 in main activity textview1 in favorites page is visible but when i click on btn2 in main activity the textview2 in favorites is visible but textview1 is no showed and only one textview showed to me, anybody can help me? i want all textview that user clicked be visible Together.
my cod is :
SharedPreferences pref = getApplicationContext().getSharedPreferences("MyPref", MODE_PRIVATE);
int score = pref.getInt("score", 0);
List<Boolean> listtt=new ArrayList<Boolean>(Arrays.asList(new Boolean[5]));
Collections.fill(listtt, new Boolean(false));
switch (score) {
case 99:
if(score == 99){
pos=99;
tv_favoritetittle.setText("Nothing");
}
break;
case 100:
if(score == 100){
listtt.set(0, true);
pos=100;
}
break;
case 101:
if(score == 101){
listtt.set(1, true);
pos=101;
}
break;
case 102:
if(score == 102){
listtt.set(2, true);
pos=102;
}
break;
default:
break;
}
and my called function to set visibility of textview:
public void setvisibility(int id){
if(id==100){
tv_fav7.setVisibility(View.VISIBLE);
}else {tv_fav7.setVisibility(View.GONE);}
if(id==101){
tv_fav6.setVisibility(View.VISIBLE);
}else {tv_fav6.setVisibility(View.GONE);}