I have a list view that displays values (names) I get from my website, then loads the url link corresponding to that name in a web view using onItemClickListener, that works fine! but when I add a if statement it doesn’t read it, can someone tell me what I’m doing wrong?
Here is the code
private AdapterView.OnItemClickListener onPeriodicosListClick = new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
cambio="";
pUrl="";
noteId = arrayOfWebData.get(position);
cambio = noteId.Medio.toString();
PeriodicosListLayout.setVisibility(View.GONE);
webLayout.setVisibility(View.VISIBLE);
pUrl = noteId.website.toString();
wvp.loadUrl(pUrl);
if ( cambio == "Periodico"){
Toast.makeText(getApplicationContext(),
cambio,
Toast.LENGTH_LONG).show();
}
if ( cambio == "Tv"){
Toast.makeText(getApplicationContext(),
cambio,
Toast.LENGTH_LONG).show();
}
}
};
the (cambio = noteId.Medio.toString();) can only be Periodico, Radio, Tv (as I have set the value of it to be any of those 3 word only) so all I want is a tost to be display telling what it is!
It should not be
but