Java tutorial
/* Copyright 2016 Pierre-Yves Lapersonne (aka. "pylapp", pylapp(dot)pylapp(at)gmail(dot)com) Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // / ? package aleajactatest.appiumcalculator; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; import java.util.List; /** * A dummy fragment representing a list of dummy items. * * @author pylapp * @since 29/12/2015 * @version 1.0.0 */ public class DummyListFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment_dummy_list, container, false); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); final List<String> items = new ArrayList<String>(); for (int i = 0; i < 30; i++) items.add("Sloubi " + (i + 1)); final ArrayAdapter<String> la = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_list_item_1, items); ListView lv = (ListView) getView().findViewById(R.id.dummyList); lv.setAdapter(la); } }