I have a very basic android app that has 1 tab, with three sub sections on it. Section 1, 2, and 3. The code below tells the app to display "1", "2", or "3" in a string depending on which section is selected. I added an if statement to see if I could alter the output, but it appears to be ignoring the condition. When I debug the code using logcat it shows the value of dummyTextView is "1", but it does not step into the condition and change it to the "Peeshaw" line i created. Anyone know why this is happening?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main_dummy,
container, false);
TextView dummyTextView = (TextView) rootView
.findViewById(R.id.section_label);
dummyTextView.setText(Integer.toString(getArguments().getInt(
ARG_SECTION_NUMBER)));
if (dummyTextView.getText() == "1")
{
dummyTextView.setText("Peeshaw");
}
if (dummyTextView.getText().toString() == "1")
{
dummyTextView.setText("Peeshaw");
}
return rootView;
}