Example usage for android.widget ListView ListView

List of usage examples for android.widget ListView ListView

Introduction

In this page you can find the example usage for android.widget ListView ListView.

Prototype

public ListView(Context context) 

Source Link

Usage

From source file:com.dpcsoftware.mn.EditCategories.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    lv = new ListView(EditCategories.this);
    app = (App) getApplication();/* w w  w. j a  v  a2 s.  c  o m*/

    renderCategories();

    getSupportActionBar().setTitle(R.string.editcategories_c1);

    Bundle args = getIntent().getExtras();
    if (args != null && args.getBoolean("ADD_CATEGORY", false) == true) {
        comingFromAddEx = true;
        AddEditDialog addDg = new AddEditDialog(this, null, AddEditDialog.ADD);
        addDg.show();
    }
}

From source file:com.cloudkick.DashboardActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    dashboard = new ListView(this);
    adapter = new NodesAdapter(this, R.layout.node_item, nodes);
    dashboard.setAdapter(adapter);/*from  w ww. java2s  .c  o  m*/
    dashboard.setOnItemClickListener(this);
    dashboard.setBackgroundColor(Color.WHITE);
    setContentView(dashboard);
    reloadAPI();
}

From source file:jsettlers.main.android.mainmenu.ui.dialogs.DirectoryPickerDialog.java

@NonNull
@Override/*from w  w w .j a v  a2  s.  c o m*/
public Dialog onCreateDialog(Bundle savedInstanceState) {
    ListView listView = new ListView(getActivity());
    listView.setAdapter(directoryAdapter);
    listView.setOnItemClickListener((arg0, arg1, position, arg3) -> {
        directoryAdapter.positionSelected(position);
        setButtonState();
    });

    return new AlertDialog.Builder(getActivity()).setTitle(R.string.resource_selection_dialog_title)
            .setView(listView).setPositiveButton(R.string.ok, (dialog, which) -> {
                androidResourcesLoader
                        .setResourcesDirectory(directoryAdapter.getCurrentDirectory().getAbsolutePath());
                ((Listener) getParentFragment()).onDirectorySelected();
            }).create();
}

From source file:com.flan.stock.fragment.FragmentNewsYw.java

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

    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    lv_yaowen = new ListView(context);
    lv_yaowen.setLayoutParams(params);/*ww w  .  jav  a2 s .  c  o m*/

    pagerView = new TouTiaoPagerView(context, getResources().getLayout(R.layout.layout_news_toutio));
    params.height = DensityUtil.dip2px(context, 150);
    pagerView.setLayoutParams(params);
    pagerView.setPagerList(toutiaoList);
    pagerView.setOnPageChangeListener(pagerView);
    lv_yaowen.addHeaderView(pagerView);

    ywAdapter = new NewsYwListViewAdapter(context, newsList);
    lv_yaowen.setAdapter(ywAdapter);

    lv_yaowen.setOnItemClickListener(new OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> arg0, View view, int position, long id) {
            //Toast.makeText(context, "position "+position+" ; id "+id, Toast.LENGTH_SHORT).show();;
            Intent intent = new Intent(context, NewsDetailActivity.class);
            intent.putExtra("news", newsList.get(position - 1));
            context.startActivity(intent);
        }
    });

    return lv_yaowen;
}

From source file:dk.dr.radio.akt.P4kanalvalg_frag.java

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

    kanalkoder = new ArrayList<String>(DRData.instans.grunddata.p4koder);

    for (String k : kanalkoder) {
        if (DRData.instans.grunddata.kanalFraKode.get(k) == null) {
            new IllegalStateException("Kanalkode mangler! Det her m ikke ske!").printStackTrace();
            DRData.instans.grunddata.kanalFraKode.put(k, new Kanal()); // reparr problemet :-(
        }//from   w  ww . jav  a2 s .  c  o m
    }

    // Da der er tale om et fast lille antal kanaler er der ikke grund til det store bogholderi
    // S vi husker bare viewsne i er array
    listeElementer = new View[kanalkoder.size()];
    kanaladapter = new KanalAdapter();

    // Opbyg arrayet p forhnd for jvnere visning
    for (int pos = 0; pos < listeElementer.length; pos++)
        kanaladapter.bygListeelement(pos);

    // St baggrunden. Normalt ville man gre det fra XML eller med
    //getListView().setBackgroundResource(R.drawable.main_app_bg);

    ListView lv = new ListView(getActivity());
    lv.setAdapter(kanaladapter);
    lv.setOnItemClickListener(this);

    //    lv.setBackgroundColor( 0xffa0a0a0);
    //    lv.setDivider(new ColorDrawable(0x80ffffff));
    //    lv.setDividerHeight(2);

    // Srg for at baggrunden bliver tegnet, ogs nr listen scroller.
    // Se http://android-developers.blogspot.com/2009/01/why-is-my-list-black-android.html
    lv.setCacheColorHint(0x00000000);
    // Man kunne have en ensfarvet baggrund, det gr scroll mere flydende
    //getListView().setCacheColorHint(0xffe4e4e4);
    return lv;
}

From source file:com.ken.bookingview.TimeSheetFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    // Inflate the layout containing a title and body text.
    mListView = new ListView(getActivity());
    mListView.setVelocityScale(0.5f);// w w w . j av  a  2s  . c o  m
    mListView.setVerticalScrollBarEnabled(false);
    mListView.setAdapter(mAdapter);
    return mListView;
}

From source file:org.dpadgett.timer.TabsAdapter.java

public TabsAdapter(SherlockFragmentActivity activity, ViewPager pager) {
    super(activity.getSupportFragmentManager());
    mContext = activity;//from  ww w .  j a  v a2  s.c  o m
    mActionBar = activity.getSupportActionBar();
    mViewPager = pager;
    mViewPager.setAdapter(this);
    mViewPager.setPageMargin(1);
    mViewPager.setPageMarginDrawable(new ListView(activity).getDivider());
    mViewPager.setOnPageChangeListener(this);
}

From source file:org.scratch.microwebserver.MicrowebserverActivity.java

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

    stcont = getApplicationContext();// w ww. j  a  va  2  s .co m

    logList = new ListView(this);
    logList.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);

    serviceList = new ListView(this);

    connectService();
}

From source file:de.vanita5.twittnuker.activity.support.MenuDialogFragment.java

@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
    final Context context = getThemedContext();
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    final MenuAdapter adapter = new MenuAdapter(context);
    final ListView listView = new ListView(context);
    listView.setAdapter(adapter);//from www. j a va 2 s. co  m
    listView.setOnItemClickListener(this);
    builder.setView(listView);
    final Menu menu = MenuUtils.createMenu(context);
    onCreateMenu(new TwidereMenuInflater(context), menu);
    adapter.setMenu(menu);
    return builder.create();
}

From source file:com.github.capone.controller.discovery.DiscoveryListFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ListView list = new ListView(getActivity());

    list.setAdapter(adapter);/*  w  w  w .  ja va  2  s.co  m*/
    list.setOnItemClickListener(this);
    list.setOnItemLongClickListener(this);

    return list;
}