Search in sources :

Example 6 with ArrayAdapter

use of android.widget.ArrayAdapter in project cw-android by commonsguy.

the class SpinnerDemo method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);
    selection = (TextView) findViewById(R.id.selection);
    Spinner spin = (Spinner) findViewById(R.id.spinner);
    spin.setOnItemSelectedListener(this);
    ArrayAdapter<String> aa = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, items);
    aa.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spin.setAdapter(aa);
}
Also used : Spinner(android.widget.Spinner) ArrayAdapter(android.widget.ArrayAdapter)

Example 7 with ArrayAdapter

use of android.widget.ArrayAdapter in project ActionBar-PullToRefresh by chrisbanes.

the class GridViewActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_gridview);
    GridView gridView = (GridView) findViewById(R.id.ptr_gridview);
    ListAdapter adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ITEMS);
    gridView.setAdapter(adapter);
    // Now find the PullToRefreshLayout and set it up
    mPullToRefreshLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);
    ActionBarPullToRefresh.from(this).options(Options.create().scrollDistance(.75f).headerLayout(R.layout.customised_header).headerTransformer(new CustomisedHeaderTransformer()).build()).allChildrenArePullable().listener(this).useViewDelegate(GridView.class, new AbsListViewDelegate()).setup(mPullToRefreshLayout);
}
Also used : AbsListViewDelegate(uk.co.senab.actionbarpulltorefresh.library.viewdelegates.AbsListViewDelegate) GridView(android.widget.GridView) ListAdapter(android.widget.ListAdapter) ArrayAdapter(android.widget.ArrayAdapter)

Example 8 with ArrayAdapter

use of android.widget.ArrayAdapter in project cw-advandroid by commonsguy.

the class TJDetect method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
    HashSet<CharSequence> runningPackages = new HashSet<CharSequence>();
    for (ActivityManager.RunningAppProcessInfo proc : am.getRunningAppProcesses()) {
        for (String pkgName : proc.pkgList) {
            runningPackages.add(pkgName);
        }
    }
    PackageManager mgr = getPackageManager();
    ArrayList<CharSequence> scary = new ArrayList<CharSequence>();
    for (PackageInfo pkg : mgr.getInstalledPackages(PackageManager.GET_PERMISSIONS)) {
        if (PackageManager.PERMISSION_GRANTED == mgr.checkPermission(android.Manifest.permission.SYSTEM_ALERT_WINDOW, pkg.packageName)) {
            if (PackageManager.PERMISSION_GRANTED == mgr.checkPermission(android.Manifest.permission.INTERNET, pkg.packageName)) {
                if (runningPackages.contains(pkg.packageName)) {
                    scary.add(mgr.getApplicationLabel(pkg.applicationInfo));
                }
            }
        }
    }
    setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, scary));
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) ArrayList(java.util.ArrayList) ActivityManager(android.app.ActivityManager) ArrayAdapter(android.widget.ArrayAdapter) HashSet(java.util.HashSet)

Example 9 with ArrayAdapter

use of android.widget.ArrayAdapter in project cw-android by commonsguy.

the class MenuDemo method add.

private void add() {
    final View addView = getLayoutInflater().inflate(R.layout.add, null);
    new AlertDialog.Builder(this).setTitle("Add a Word").setView(addView).setPositiveButton("OK", new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int whichButton) {
            ArrayAdapter<String> adapter = (ArrayAdapter<String>) getListAdapter();
            EditText title = (EditText) addView.findViewById(R.id.title);
            adapter.add(title.getText().toString());
        }
    }).setNegativeButton("Cancel", null).show();
}
Also used : AlertDialog(android.app.AlertDialog) EditText(android.widget.EditText) DialogInterface(android.content.DialogInterface) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) ArrayAdapter(android.widget.ArrayAdapter)

Example 10 with ArrayAdapter

use of android.widget.ArrayAdapter in project cw-omnibus by commonsguy.

the class HeaderFooterDemo method buildHeader.

private View buildHeader() {
    Button btn = new Button(this);
    btn.setText("Randomize!");
    btn.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            List<String> list = Arrays.asList(items);
            Collections.shuffle(list);
            setListAdapter(new ArrayAdapter<String>(HeaderFooterDemo.this, android.R.layout.simple_list_item_1, list));
        }
    });
    return (btn);
}
Also used : Button(android.widget.Button) List(java.util.List) TextView(android.widget.TextView) View(android.view.View) ArrayAdapter(android.widget.ArrayAdapter)

Aggregations

ArrayAdapter (android.widget.ArrayAdapter)292 View (android.view.View)150 TextView (android.widget.TextView)99 ListView (android.widget.ListView)88 AdapterView (android.widget.AdapterView)87 ArrayList (java.util.ArrayList)52 Spinner (android.widget.Spinner)51 ViewGroup (android.view.ViewGroup)39 Intent (android.content.Intent)31 AutoCompleteTextView (android.widget.AutoCompleteTextView)29 Button (android.widget.Button)26 ImageView (android.widget.ImageView)26 ListAdapter (android.widget.ListAdapter)21 DialogInterface (android.content.DialogInterface)20 LayoutInflater (android.view.LayoutInflater)18 LinearLayout (android.widget.LinearLayout)18 Bundle (android.os.Bundle)17 RecyclerView (android.support.v7.widget.RecyclerView)17 OnItemClickListener (android.widget.AdapterView.OnItemClickListener)17 EditText (android.widget.EditText)15