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:com.simplechatclient.android.ProfileRegisterFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    view = inflater.inflate(R.layout.profile_register_fragment, container, false);
    context = container.getContext();/*ww  w  . j ava 2s .c  o  m*/

    myStart();

    return view;
}

From source file:org.deviceconnect.android.uiapp.fragment.profile.FileProfileFragment.java

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

    View view = inflater.inflate(R.layout.fragment_file_service, container, false);
    view.setBackgroundColor(getResources().getColor(android.R.color.background_light));

    // ?//from w w  w  .  ja  v a 2  s .  c o  m
    List<Map<String, Object>> empty = new ArrayList<Map<String, Object>>();
    mListAdapter = new ListAdapter(getActivity(), empty);

    // ListView?
    mListView = (ListView) view.findViewById(R.id.listview);
    mListView.setAdapter(mListAdapter);
    mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(final AdapterView<?> parent, final View view, final int position,
                final long id) {
            @SuppressWarnings("unchecked")
            final Map<String, Object> item = (Map<String, Object>) mListAdapter.getItem(position);
            int type = (Integer) item.get(FileProfileConstants.PARAM_FILE_TYPE);
            if (type == FileProfileConstants.FileType.FILE.getValue()) {
                // ??
                String path = (String) item.get(FileProfileConstants.PARAM_PATH);
                GetFileListTask task = new GetFileListTask();
                task.execute(path);
            }
        }
    });
    // 
    GetFileListTask task = new GetFileListTask();
    task.execute();
    return view;
}

From source file:net.majorkernelpanic.spydroid.ui.HandsetFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.main, container, false);
    mLine1 = (TextView) rootView.findViewById(R.id.line1);
    mLine2 = (TextView) rootView.findViewById(R.id.line2);
    mVersion = (TextView) rootView.findViewById(R.id.version);
    mSignWifi = (TextView) rootView.findViewById(R.id.advice);
    mSignStreaming = (TextView) rootView.findViewById(R.id.streaming);
    mSignInformation = (LinearLayout) rootView.findViewById(R.id.information);
    mPulseAnimation = AnimationUtils.loadAnimation(SpydroidApplication.getContext(), R.anim.pulse);

    mStartButton = (Button) rootView.findViewById(R.id.startMeeting);
    mStopButton = (Button) rootView.findViewById(R.id.stopMeeting);

    return rootView;
}

From source file:com.example.office.ui.calendar.EventFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mInflater = inflater;//from  w w  w  . j  ava2  s  .  c  om
    View rootView = inflater.inflate(getFragmentLayoutId(), container, false);

    try {
        Activity activity = getActivity();
        activity.getActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

        Intent intent = getActivity().getIntent();
        event = (Event) intent.getExtras().get(getActivity().getString(R.string.intent_event_key));
        displayEvent(rootView);
        getActivity().setProgressBarIndeterminateVisibility(false);

        // Code below will be invoked when we receive system intent holding the path to shared image and this image is transformed into bytes[].
        mImagePicker = new ImagePicker(getActivity(), getActivity().getString(R.string.intent_event_key)) {
            @Override
            public void processImage(final byte[] imageBytes, final String fileName, final Object intentArg) {
                try {
                    String itemId = "";
                    if (intentArg instanceof Event) {
                        itemId = ((Event) intentArg).getId();
                    }

                    if (!TextUtils.isEmpty(itemId)) {
                        // Getting event by id
                        Futures.addCallback(Me.getEvents().getAsync(itemId), new FutureCallback<IEvent>() {
                            @Override
                            public void onFailure(Throwable t) {
                                if (!onError(t)) {
                                    mImagePicker.showStatusToast(Status.UPLOAD_FAILED);
                                }
                            }

                            @Override
                            public void onSuccess(IEvent event) {
                                try {
                                    IFileAttachment attachment = event.getAttachments().newFileAttachment();
                                    attachment.setContentBytes(imageBytes).setName(fileName);
                                    // Propagating changes to server
                                    Me.flush();

                                    mImagePicker.showStatusToast(Status.UPLOAD_SUCCESS);
                                } catch (Exception e) {
                                    onFailure(e);
                                }
                            }
                        });
                    }
                } catch (Exception e) {
                    if (!onError(e)) {
                        mImagePicker.showStatusToast(Status.UPLOAD_FAILED);
                    }
                }
            }
        };
    } catch (Exception e) {
        Logger.logApplicationException(e, getClass().getSimpleName() + ".onCreateView(): Error.");
    }

    return rootView;
}

From source file:com.markupartist.sthlmtraveling.FavoritesFragment.java

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

From source file:com.ymt.demo1.plates.knowledge.KnowledgeItemListViewFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_scrollview_ultra_list_view, container, false);
    initView(view);/*  w  w w  .j a va 2 s  . com*/
    return view;
}

From source file:com.chess.genesis.activity.LoginFrag.java

@Override
public View onCreateView(final LayoutInflater inflater, final ViewGroup container,
        final Bundle savedInstanceState) {
    initBaseContentFrag(container);/*from w ww. j av  a 2 s  . c o  m*/

    final View view = inflater.inflate(R.layout.fragment_login, container, false);

    // create network client instance
    net = new NetworkClient(act, handle);
    progress = new ProgressMsg(act, handle);

    // setup click listeners
    View image = view.findViewById(R.id.login);
    image.setOnClickListener(this);
    image = view.findViewById(R.id.register);
    image.setOnClickListener(this);

    // Always show the currently logged in user
    final Pref pref = new Pref(act);
    if (pref.getBool(R.array.pf_isLoggedIn)) {
        final EditText txt = (EditText) view.findViewById(R.id.username);
        txt.setText(pref.getString(R.array.pf_username));
    }
    return view;
}

From source file:in.codehex.facilis.ViewBidItemsFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_view_bid_items, container, false);

    initObjects(view);//  w  w  w .j a  v  a2 s. com
    prepareObjects();

    return view;
}

From source file:com.google.cast.samples.games.spritedemo.SpriteDemoFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mJsonMessage = new JSONObject();
    try {/* w w w. ja  v  a 2s .  c om*/
        mJsonMessage.put("type", 1);
    } catch (JSONException e) {
        Log.e(TAG, "Error creating JSON message", e);
    }

    // Inflate the layout for this fragment.
    View view = inflater.inflate(R.layout.spritedemo_fragment, container, false);
    mAddSpriteButton = (Button) view.findViewById(R.id.button_add_sprite);
    mAddSpriteButton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            CastConnectionManager manager = SpritedemoApplication.getInstance().getCastConnectionManager();
            manager.getGameManagerClient().sendGameMessage(mJsonMessage);
        }
    });

    return view;
}

From source file:com.akoscz.youtube.YouTubeFragment.java

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

    Picasso.with(getActivity()).setDebugging(true);

    View rootView = inflater.inflate(R.layout.youtube_fragment, container, false);

    mListView = (ListView) rootView.findViewById(R.id.youtube_listview);

    // restore the playlist after an orientation change
    if (savedInstanceState != null) {
        mPlaylist = new Gson().fromJson(savedInstanceState.getString(PLAYLIST_KEY), Playlist.class);
    }//w  w w  . jav a  2s. co m

    // ensure the adapter and listview are initialized
    if (mPlaylist != null) {
        initListAdapter(mPlaylist);
    }

    // start loading the first page of our playlist
    new GetYouTubePlaylistAsyncTask() {
        @Override
        public EtagCache getEtagCache() {
            return mEtagCache;
        }

        @Override
        public void onPostExecute(JSONObject result) {
            handlePlaylistResult(result);
        }
    }.execute(YOUTUBE_PLAYLIST, null);

    return rootView;
}