mercredi 4 février 2015

Android if else statement on an activity call for layout

So guys i get a force close on this, it doesn't load anything on my LogCat i cant seem to find out whats wrong.. can anyone please tell me why is this happening i believe my logic is correct or is it not possible to declare an if else statement when calling for a layout to display? if not, can anyone tell me another way of doing this? it just opens a layout incase the keyword is taxi stored in my global variable which i just call anytime i want.



public class TaxiInfoWindowAdapter implements GoogleMap.InfoWindowAdapter {

private final View mContentsView;
private Activity mActivity;
public String title_value = (Holder.myValue).toString();

public TaxiInfoWindowAdapter(Activity act){

if(title_value.equals("Taxi")){
mContentsView = act.getLayoutInflater().inflate(R.layout.taxi_info_window, null);
mActivity = act;

}else{
mContentsView = act.getLayoutInflater().inflate(R.layout.info_window, null);
mActivity = act;

}

}
}

Aucun commentaire:

Enregistrer un commentaire