Android Open Source - Android-TabDemo Tab Fragment






From Project

Back to project page Android-TabDemo.

License

The source code is released under:

MIT License

If you think the Android project Android-TabDemo listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bradbergeron.android.tabdemo;
// w ww.ja  va 2  s . c o  m
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

public class TabFragment extends Fragment {
    public static final String ARGS_TAB_NAME = "tabName";

    private static final String TAG = TabFragment.class.getSimpleName();

    private String mName;

    public TabFragment () { }

    @Override
    public void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (getArguments() != null) {
            mName = getArguments().getString(ARGS_TAB_NAME, "Unnamed");
        }
    }

    @Override
    public View onCreateView (LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_tab, container, false);

        TextView nameTextView = (TextView) view.findViewById(R.id.tabTextView);
        nameTextView.setText(mName);

        return view;
    }
}




Java Source Code List

com.bradbergeron.android.tabdemo.AboutFragment.java
com.bradbergeron.android.tabdemo.MainActivity.java
com.bradbergeron.android.tabdemo.TabFragment.java
com.bradbergeron.android.tabdemo.TabsFragment.java