Example usage for android.view LayoutInflater inflate

List of usage examples for android.view LayoutInflater inflate

Introduction

In this page you can find the example usage for android.view LayoutInflater inflate.

Prototype

public View inflate(XmlPullParser parser, @Nullable ViewGroup root, boolean attachToRoot) 

Source Link

Document

Inflate a new view hierarchy from the specified XML node.

Usage

From source file:fr.cph.chicago.core.fragment.BikeFragment.java

@Override
public final View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.fragment_bike, container, false);
    if (!activity.isFinishing()) {
        unbinder = ButterKnife.bind(this, rootView);
        if (!bikeStations.isEmpty()) {
            loadList();/*  w  w w  . j  av a  2s.  co  m*/
        } else {
            loadError();
        }
    }
    return rootView;
}

From source file:br.com.hype.medan.ThisFreeFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Inflate the layout for this fragment
    //This layout contains your list view
    View view = inflater.inflate(R.layout.fragment_happening, container, false);

    eventList = new ArrayList<Event>();
    new JSONAsyncTask().execute("http://api.hypemedan.id/androidapi/list_event_happening.php");

    //now you must initialize your list view
    ListView listview = (ListView) view.findViewById(R.id.lv_item);

    adapter = new EventAdapter(getActivity(), R.layout.lsv_item_event, eventList);

    listview.setAdapter(adapter);/*from  w  w  w  . java 2s . co m*/

    //To have custom list view use this : you must define CustomeAdapter class
    // listview.setadapter(new CustomeAdapter(getActivity()));
    //getActivty is used instead of Context
    return view;

}

From source file:cn.newgxu.android.bbs.ui.TopicFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    topicView = inflater.inflate(R.layout.topic, container, false);
    authorNick = (TextView) topicView.findViewById(R.id.topic_author_nick);
    content = (WebView) topicView.findViewById(R.id.topic_content);
    userIcon = (ImageView) topicView.findViewById(R.id.user_icon);
    statistics1 = (TextView) topicView.findViewById(R.id.topic_author_statistics1);
    sendReply = (EditText) topicView.findViewById(R.id.send_reply);
    sendIcon = (ImageView) topicView.findViewById(R.id.send_reply_icon);
    if (savedInstanceState != null) {
        sendReply.setText(savedInstanceState.getString("reply_content"));
    }/*ww  w.j a v  a 2 s  .  c  o m*/
    //      statistics2 = (TextView) topicView.findViewById(R.id.topic_author_statistics2);
    OnClickListener listener = (OnClickListener) getSherlockActivity();
    sendIcon.setOnClickListener(listener);
    topicView.findViewById(R.id.author).setOnClickListener(listener);
    //      userIcon.setOnClickListener(this);
    desc = (TextView) topicView.findViewById(R.id.topic_author_desc);
    return this.topicView;
}

From source file:com.achep.acdisplay.ui.components.NotifyWidget.java

@Override
protected View onCreateIconView(@NonNull LayoutInflater inflater, @NonNull ViewGroup container) {
    View view = inflater.inflate(R.layout.notification_icon, container, false);
    assert view != null;

    mIconView = (NotificationIconWidget) view;
    mIconView.setNotification(mNotification);
    return view;//from w  w  w .  ja v  a  2  s  .  c o  m
}

From source file:com.irontec.fragments.EzarpenakFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    setHasOptionsMenu(true);/*  w w  w .ja  v  a  2  s  . co  m*/

    mContext = getActivity().getBaseContext();

    View rootView = inflater.inflate(R.layout.fragment_ezarpenak, container, false);
    mViewSwitcher = (ViewSwitcher) rootView.findViewById(R.id.viewSwitcher1);
    mEzarpenZerrenda = (ListView) rootView.findViewById(R.id.ezarpenak_list);

    mItems = new ArrayList<BasicNameValuePair>();

    BasicNameValuePair item1 = new BasicNameValuePair("Saioa itxi", "");
    BasicNameValuePair item2 = new BasicNameValuePair("Sare sozialak", "Zure sare sozialak kudeatu");
    BasicNameValuePair item3 = new BasicNameValuePair("Lizentziak", "Erabilitako baliabideak");
    BasicNameValuePair item4 = new BasicNameValuePair("Honi buruz", "");

    mItems.add(item1);
    mItems.add(item2);
    mItems.add(item3);
    mItems.add(item4);

    mEzarpenZerrenda.setAdapter(new SimpleLicenseAdapter(mContext, mItems));
    mEzarpenZerrenda.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
            Intent intent = null;
            if (position == 0) {
                MintzatuAPI.logout(mContext);
                intent = new Intent(getActivity().getBaseContext(), LoginCircles.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(intent);
                if (getActivity() != null) {
                    getActivity().finish();
                }
            } else if (position == 3) {
                intent = new Intent(mContext, HoniBuruzActivity.class);
            } else {
                intent = new Intent(mContext, EzarpenakDetailActivity.class);
            }

            switch (position) {
            case 1:
                intent.putExtra("detail_type", 0);
                break;
            case 2:
                intent.putExtra("detail_type", 1);
                break;
            default:
                break;
            }

            if (intent != null) {
                startActivity(intent);
            }
        }
    });

    mViewSwitcher.showNext();

    return rootView;
}

From source file:com.otaupdater.KernelTab.java

@Override
public View onCreateView(@NotNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.list, container, false);
}

From source file:de.kirchnerei.bicycle.battery.BatteryEditFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    return inflater.inflate(R.layout.fragment_battery_edit, container, false);
}

From source file:com.example.administrator.myapplication2._5_Group._5_Group.LeftFragment.java

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

    SharedPreferences myPrefs = this.getActivity().getSharedPreferences("login", Context.MODE_PRIVATE);
    if ((myPrefs != null) && (myPrefs.contains("id"))) {
        id = myPrefs.getString("id", "");
        Log.i("logintest", id.toString());
    }//w w  w  .  j av  a2 s.  c o  m

    tvGroupName = (TextView) rootView.findViewById(R.id.tvGroupName);
    tvGroupMember = (TextView) rootView.findViewById(R.id.tvGroupMember);

    goutBtn = (ImageButton) rootView.findViewById(R.id.goutBtn);
    goutBtn.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            new AlertDialog.Builder(getActivity()).setTitle("")
                    .setMessage("? ?").setNegativeButton(android.R.string.no, null)
                    .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

                        public void onClick(DialogInterface arg0, int arg1) {
                            outGroup();
                        }
                    }).create().show();
        }
    });

    getGroupName();

    return rootView;

}

From source file:com.cloudkick.CheckViewActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    CheckViewState previousState = (CheckViewState) getLastNonConfigurationInstance();
    if (previousState != null) {
        nodeName = previousState.nodeName;
        nodeId = previousState.nodeId;//from   w w  w. j av a  2 s.c o  m
        checkId = previousState.checkId;
        check = previousState.check;
    } else {
        Bundle data = this.getIntent().getExtras();
        nodeName = (String) data.getSerializable("nodeName");
        nodeId = (String) data.getSerializable("nodeId");
        checkId = (String) data.getSerializable("checkId");
        check = (Check) data.getSerializable("check");
    }

    String inflater = Context.LAYOUT_INFLATER_SERVICE;
    LayoutInflater li = (LayoutInflater) getSystemService(inflater);

    checkView = new RelativeLayout(this);
    li.inflate(R.layout.check_view, checkView, true);
    setContentView(checkView);

    setTitle(nodeName + ": " + check.type + " check");
    redrawCheck();
    reloadAPI();
}

From source file:li.klass.fhem.fragments.SendCommandFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);

    final View view = inflater.inflate(R.layout.command_execution, container, false);
    Button sendButton = (Button) view.findViewById(R.id.send);
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override/*  w w w .j  a va  2s . c  o  m*/
        public void onClick(View button) {
            EditText editText = (EditText) view.findViewById(R.id.input);
            String command = editText.getText().toString();

            sendCommandIntent(command);
        }
    });

    ListView recentCommandsList = (ListView) view.findViewById(R.id.command_history);
    recentCommandsAdapter = new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1);
    recentCommandsList.setAdapter(recentCommandsAdapter);
    recentCommandsList.setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
            String command = recentCommands.get(position);
            sendCommandIntent(command);
        }
    });

    return view;
}