List of usage examples for android.widget AdapterView getAdapter
public abstract T getAdapter();
From source file:org.iisgcp.waterwalk.fragment.PointOfInterestGridFragment.java
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); List<RowItem> rowItems = null; TypedArray route = getResources().obtainTypedArray(getArguments().getInt(Constants.INTENT_RES_ID)); TypedArray pois = getResources().obtainTypedArray(route.getResourceId(5, -1)); route.recycle();//from w w w. ja v a 2 s .c om List<Integer> imageIds = new ArrayList<Integer>(); rowItems = new ArrayList<RowItem>(); for (int i = 0; i < pois.length(); i++) { TypedArray poi = getResources().obtainTypedArray(pois.getResourceId(i, -1)); String title = getString(poi.getResourceId(0, -1)); int imageId = poi.getResourceId(1, -1); imageIds.add(imageId); rowItems.add(buildRow(imageId, title, pois.getResourceId(i, -1))); poi.recycle(); } pois.recycle(); mAdapter = new RouteGridAdapter(getActivity(), ((PointOfInterestGridViewPagerFragment) getParentFragment()).getImageFetcher(), rowItems); mList.setAdapter(mAdapter); mList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RowItem rowItem = (RowItem) parent.getAdapter().getItem(position); Intent intent = new Intent(PointOfInterestGridFragment.this.getActivity(), PointOfInterestDetailActivity.class); intent.putExtra(Constants.INTENT_TITLE, rowItem.getTitle()); intent.putExtra(Constants.INTENT_RES_ID, rowItem.getResId()); mListener.onItemClicked(intent); } }); }
From source file:com.gh4a.fragment.IssueListFragment.java
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { Issue issue = (Issue) adapterView.getAdapter().getItem(position); Intent intent = new Intent().setClass(getSherlockActivity(), IssueActivity.class); intent.putExtra(Constants.Repository.REPO_OWNER, mRepoOwner); intent.putExtra(Constants.Repository.REPO_NAME, mRepoName); intent.putExtra(Constants.Issue.ISSUE_NUMBER, issue.getNumber()); intent.putExtra(Constants.Issue.ISSUE_STATE, issue.getState()); startActivity(intent);/* w w w. j av a2 s . c o m*/ }
From source file:org.exfio.weavedroid.syncadapter.EnterCredentialsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.enter_credentials, container, false); // protocol selection spinner textHttpWarning = (TextView) v.findViewById(R.id.http_warning); spnrProtocol = (Spinner) v.findViewById(R.id.select_protocol); spnrProtocol.setOnItemSelectedListener(new OnItemSelectedListener() { @Override// w ww .ja v a2s .c o m public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { protocol = parent.getAdapter().getItem(position).toString(); textHttpWarning.setVisibility(protocol.equals("https://") ? View.GONE : View.VISIBLE); } @Override public void onNothingSelected(AdapterView<?> parent) { protocol = null; } }); spnrProtocol.setSelection(1); // HTTPS // other input fields editBaseURL = (EditText) v.findViewById(R.id.baseURL); editBaseURL.addTextChangedListener(this); editUserName = (EditText) v.findViewById(R.id.userName); editUserName.addTextChangedListener(this); editPassword = (EditText) v.findViewById(R.id.password); editPassword.addTextChangedListener(this); labelSyncKey = (TextView) v.findViewById(R.id.synckeylabel); editSyncKey = (EditText) v.findViewById(R.id.synckey); editSyncKey.addTextChangedListener(this); // hook into action bar setHasOptionsMenu(true); //TODO - Move synckey to manual configuration fragment labelSyncKey.setVisibility(View.INVISIBLE); editSyncKey.setVisibility(View.INVISIBLE); //Dev environment //spnrProtocol.setSelection(0); //editBaseURL.setText("argent.local:8081"); //editUserName.setText("gerry"); //editPassword.setText("test1234"); //FIXME - Debug only //ownCloud environment spnrProtocol.setSelection(0); editBaseURL.setText("cloud.kaleido.com.au/remote.php/mozilla_sync/"); return v; }
From source file:com.naroran.onsport.fragment.LiveScoreFragment.java
public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ScoreItem s = (ScoreItem) ((ScoreAdapter) parent.getAdapter()).getItem(position); Log.d("ANDIS", "CLICK = " + s.getScore()); }
From source file:liqui.droid.activity.InstanceListCached.java
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { Cursor c = (Cursor) adapterView.getAdapter().getItem(position); Intent intent = new Intent().setClass(InstanceListCached.this, InstanceEdit.class); Uri uri = Uri.parse(DBSystemProvider.INSTANCE_CONTENT_URI + "/" + c.getInt(c.getColumnIndex(DBSystem.Instance.COLUMN_ID))); intent.putExtra(DBSystemProvider.INSTANCE_CONTENT_ITEM_TYPE, uri); startActivityForResult(intent, ACTIVITY_EDIT); }
From source file:liqui.droid.activity.LQFBListCached.java
@Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { Cursor c = (Cursor) adapterView.getAdapter().getItem(position); Intent intent = new Intent().setClass(LQFBListCached.this, LQFBEdit.class); Uri uri = Uri.parse(DBSystemProvider.LQFBS_CONTENT_URI + "/" + c.getInt(c.getColumnIndex(DBSystem.TableLQFBs.COLUMN_ID))); intent.putExtra(DBSystemProvider.LQFBS_CONTENT_ITEM_TYPE, uri); startActivityForResult(intent, ACTIVITY_EDIT); }
From source file:org.iisgcp.waterwalk.fragment.RoutesGridFragment.java
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); List<RowItem> rowItems = null; TypedArray routes = getResources().obtainTypedArray(R.array.routes); List<Integer> imageIds = new ArrayList<Integer>(); rowItems = new ArrayList<RowItem>(); for (int i = 0; i < routes.length(); i++) { TypedArray route = getResources().obtainTypedArray(routes.getResourceId(i, -1)); String title = getString(route.getResourceId(0, -1)); int imageId = route.getResourceId(1, -1); imageIds.add(imageId);// w w w . j av a 2 s .c o m rowItems.add(buildRow(imageId, title, routes.getResourceId(i, -1))); route.recycle(); } routes.recycle(); mAdapter = new RouteGridAdapter(getActivity(), mImageFetcher, rowItems); mList.setAdapter(mAdapter); mList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { RowItem rowItem = (RowItem) parent.getAdapter().getItem(position); Intent intent = new Intent(RoutesGridFragment.this.getActivity(), PointOfInterestActivity.class); intent.putExtra(Constants.INTENT_TITLE, rowItem.getTitle()); intent.putExtra(Constants.INTENT_RES_ID, rowItem.getResId()); intent.putExtra(Constants.INTENT_TAB, 0); intent.putExtra(Constants.INTENT_POSITION, position); intent.putExtra(Constants.INTENT_DRAWER_POSITION, 0); RoutesGridFragment.this.startActivity(intent); } }); }
From source file:com.acdd.homelauncher.fragment.InstalledAppFragment.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String location = (String) parent.getAdapter().getItem(position); final PackageLite packageLite = ACDD.getInstance().getBundlePackageLite(location); if (packageLite != null) { AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity()); //?//from w w w .ja v a 2 s .c om builder.setIcon(R.mipmap.ic_launcher); //? builder.setTitle("??"); //0: ? final String[] comp = new String[packageLite.components.size()]; packageLite.components.toArray(comp); builder.setSingleChoiceItems(comp, 0, new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String className = (String) (comp[which]); if (!className.contains("Activity")) { Toast.makeText(getActivity(), "Support Activity Only", Toast.LENGTH_SHORT).show(); dialog.dismiss(); return; } Intent mIntent = new Intent(); mIntent.setClassName(getActivity(), className); startActivity(mIntent); dialog.dismiss(); } }); // builder.setPositiveButton(" ", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); //?? builder.create().show(); } }
From source file:android.support.v7.view.menu.MenuPopup.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ListAdapter outerAdapter = (ListAdapter) parent.getAdapter(); MenuAdapter wrappedAdapter = toMenuAdapter(outerAdapter); // Use the position from the outer adapter so that if a header view was added, we don't get // an off-by-1 error in position. wrappedAdapter.mAdapterMenu.performItemAction((MenuItem) outerAdapter.getItem(position), this, // always make sure that we show the sub-menu closeMenuOnSubMenuOpened() ? 0 : SupportMenu.FLAG_KEEP_OPEN_ON_SUBMENU_OPENED); }
From source file:com.gh4a.fragment.CommitListFragment.java
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { RepositoryCommit commit = (RepositoryCommit) adapterView.getAdapter().getItem(position); Intent intent = new Intent().setClass(getSherlockActivity(), CommitActivity.class); String[] urlPart = commit.getUrl().split("/"); intent.putExtra(Constants.Repository.REPO_OWNER, urlPart[4]); intent.putExtra(Constants.Repository.REPO_NAME, urlPart[5]); intent.putExtra(Constants.Object.OBJECT_SHA, commit.getSha()); intent.putExtra(Constants.Object.TREE_SHA, commit.getCommit().getTree().getSha()); startActivity(intent);/* w w w . ja va 2s.co m*/ }