Android: text in the textview is diappearing when changing the screen
<p>In my app i display a text when there are no search result, it is working fine, but when  i  change the screen and come back that text is disappearing below is my code</p>

<pre><code>private void hideIcons(Menu menu, boolean isMenu, boolean isOldDataReload) {
        ImageView leftImage = ((ImageView) findViewById(R.id.moveleft));
        leftImage.setVisibility(View.VISIBLE);
        leftImage.setImageResource(R.drawable.leftarrow_red);
        ((ImageView) findViewById(R.id.moveright)).setVisibility(View.GONE);
        ((ImageView) findViewById(R.id.favorite_cities))
                .setVisibility(View.GONE);
        try {

            if (menu != null &amp;&amp; menu.getMenuId().equals(Constants.menuWeatherId)) {

                new Utils().loadCityNames(activity, R.string.weather, -1, R.string.at, null, -1, false);
                new MenuUtils().loadData(activity, menu, "SearchAttraction",
                        isOldDataReload);

            } else if (menu != null) {

                if (menu.getSubMenuId() != null &amp;&amp; !menu.getSubMenuId().trim().equals("")) {

                    new Utils().loadCityNames(activity, getResources().getIdentifier(menu.getSubMenuId(), "string", getPackageName()), getResources().getIdentifier(menu.getMenuId(),"string", getPackageName()), R.string.near, null, -1, false);
                } else {

                    if(menu.getMenuId().equalsIgnoreCase(Constants.menuCustomSearchId)){

                        new Utils().loadCityNames(activity, -1, -1, R.string.near, menu.getPrimaryKeyword(), -1, false);
                    }else{

                        new Utils().loadCityNames(activity, -1, getResources().getIdentifier(menu.getMenuId(), "string", getPackageName()), R.string.near, null, -1, false);
                    }
                }
                ((ListView) findViewById(R.id.menusearchlist)).setVisibility(View.VISIBLE);
                try {
                    new MenuUtils().loadData(activity, menu, "SearchAttraction", isOldDataReload);
                    sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
                } catch (Exception e) {
                    Log.e(TAG, "", e);
                }
            } else {

                TextView norecords=((TextView) findViewById(R.id.norecords));
                norecords.setVisibility(View.VISIBLE);
                norecords.setText(R.string.nodatafoundsearch);
                ((ListView) findViewById(R.id.menusearchlist)).setVisibility(View.GONE);
                if (softKey != null &amp;&amp; softKey.equalsIgnoreCase("yes")) {
                    norecords.setText(R.string.nodatafoundsearch);
                    ((ListView) findViewById(R.id.menusearchlist)).setVisibility(View.VISIBLE);
                    final EditText customKeyWord = (EditText) activity.findViewById(R.id.searchname);
                    customKeyWord.setFocusable(true);
                    customKeyWord.setFocusableInTouchMode(true);
                } 
                new Utils().loadNames(activity, R.string.nofilter, -1, R.string.near, null, -1, false);

            }
        } catch (Exception e) {
            new Utils().loadNames(activity, R.string.nofilter, -1,R.string.near, null, -1, false);
            Log.e(TAG, "", e);
        }
    }
</code></pre>

<p>this is how iam hiding and displaying my text in textviews..Any help is appreciated.</p>
