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);
}
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);
}
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));
}
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();
}
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);
}
Aggregations