1

I don't have problems with appearance but when begin it, it shows nothing. I think only inflate the layout but I want call the class of my Fragments where I do all everything

class PlaceholderFragment:

public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = null;
        switch (getArguments().getInt(ARG_SECTION_NUMBER)) {
            case 1:
                rootView = (View) inflater.inflate(R.layout.fragment_first, container, false);
                break;
            case 2:
                rootView = (View) inflater.inflate(R.layout.fragment_second, container, false);
                break;
            case 3:
                rootView = (View) inflater.inflate(R.layout.fragment_third, container, false);
                break;
        }
        return rootView;
    }

My class FirstFragment:

public class PrimerFragment extends AppCompatActivity {

Location location;
LocationManager locationManager;
LocationListener locationListener;
AlertDialog alert = null;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fragment_primer);

    resultado = (TextView) findViewById(R.id.resultado);
    resultado.setText("Hello");

    locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
}  

I know my class isn't complete but only want try why shows nothing. And don't show even the Toast. thanks

  • It's unclear where your fragments are located. What are the contents of the relevant xml layouts? – Nachi Apr 01 '16 at 09:16

0 Answers0