List of usage examples for android.widget AdapterView getItemAtPosition
public Object getItemAtPosition(int position)
From source file:com.ls.drupal8demo.CategoryFragment.java
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { ArticlePreview article = (ArticlePreview) parent.getItemAtPosition(position); Intent intent = ArticleActivity.getExecutionIntent(getActivity(), article); getActivity().startActivity(intent); }
From source file:curiosamente.com.app.activities.main.Bar.BarFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.main_fragment_bar, container, false); ListView barListView = (ListView) rootView.findViewById(R.id.bar_list); ArrayAdapter<Bar> barListAdapter = new BarAdapter(getActivity(), bars); barListView.setAdapter(barListAdapter); barListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//w w w. j a v a2s.c o m public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Bar bar = (Bar) adapterView.getItemAtPosition(position); BarManager.storeSelectedBarPreference(getActivity(), bar); LocalBroadcastManager broadcaster = LocalBroadcastManager.getInstance(getActivity()); Intent intent = new Intent(BroadcastReceiverConstant.BROADCAST_RECEIVER_MAINACTIVITY); intent.putExtra(BroadcastReceiverConstant.BROADCAST_RECEIVER_RETURN_OBJECT, bar); intent.putExtra(BroadcastReceiverConstant.BROADCAST_RECEIVER_TYPE, BroadcastReceiverType.BAR_SELECTED); broadcaster.sendBroadcast(intent); } }); return rootView; }
From source file:com.chale22.ico01.iconfragment.IconFragmentGames.java
@Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { String icon = adapterView.getItemAtPosition(i).toString(); Intent result = new Intent(null, Uri.withAppendedPath(CONTENT_URI, icon)); setResult(RESULT_OK, result);//from w w w . j ava2 s .co m finish(); }
From source file:com.skubit.android.example.SkusFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ListView listView = new ListView(getActivity()); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/* w ww .j a v a 2 s. com*/ public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Map<String, String> map = (Map<String, String>) parent.getItemAtPosition(position); ((MainActivity) getActivity()).makePurchase(map); } }); ((MainActivity) getActivity()).fetchSkus(listView); return listView; }
From source file:com.chess.genesis.activity.GameListFrag.java
public void onItemClick(final AdapterView<?> parent, final View view, final int position, final long id) { final Bundle data = (Bundle) parent.getItemAtPosition(position); loadGame(data);//from w w w .j a v a2 s. com }
From source file:com.auth0.lock.fragment.SmallSocialListFragment.java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); Bundle bundle = getArguments();/* w w w.j av a2s .c o m*/ List<String> services = bundle.getStringArrayList(SOCIAL_FRAGMENT_STRATEGIES_ARGUMENT); Log.d(TAG, "About to display " + services.size() + " services"); gridView = (GridView) view.findViewById(R.id.com_auth0_social_grid_view); final SocialListAdapter adapter = new SocialListAdapter(getActivity(), services.toArray(new String[services.size()]), true); gridView.setAdapter(adapter); int maxItemCount = getResources().getInteger(R.integer.com_auth0_social_grid_max_elements); gridView.setNumColumns(services.size() > maxItemCount ? maxItemCount : services.size()); gridView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String serviceName = (String) parent.getItemAtPosition(position); Log.d(SocialFragment.class.getName(), "Selected service " + serviceName); bus.post(new IdentityProviderAuthenticationRequestEvent(serviceName)); } }); }
From source file:com.cyrilmottier.android.polaris2demo.LayersDemoActivity.java
@Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { setLayer((String) parent.getItemAtPosition(position)); }
From source file:org.ambient.control.navigation.NavigationActivity.java
private void createNavigationDrawer() { DrawerLayout drawerLayout = (DrawerLayout) this.findViewById(R.id.drawer_layout); drawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); String[] values = new String[] { "Mein Ambiente", "Mein Klima", "Meine Prozesse", "NFC-Tag anlernen" }; ListView drawerListView = (ListView) this.findViewById(R.id.homeLeftDrawer); drawerListView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, values)); // // Set the list's click listener drawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from w ww. j a v a2s . c o m*/ public void onItemClick(AdapterView<?> parent, final View view, int position, long id) { final String navigation = (String) parent.getItemAtPosition(position); if (navigation.equals("Mein Ambiente")) { startActivity(HomeActivity.class); } if (navigation.equals("Meine Prozesse")) { startActivity(ProcessCardActivity.class); } } }); }
From source file:com.example.awesomedogs.ui.MainActivity.java
@Override public void onItemClick(AdapterView<?> list, View view, int position, long id) { // Open details activity for the dog with this ID String dogId = ((Dog) list.getItemAtPosition(position)).getId(); DogDetailActivity.startActivity(this, dogId); }
From source file:ca.uwaterloo.magic.goodhikes.HistoryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_history); database = RoutesDatabaseManager.getInstance(this); userManager = new UserManager(getApplicationContext()); routes = database.getAllRoutes(Route.filterByUser(userManager.getUser())); routesAdapter = new RoutesAdapter(this, routes); View rootView = findViewById(android.R.id.content); mListView = (ListView) rootView.findViewById(R.id.routes_list); mListView.setAdapter(routesAdapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override//from w ww. j a v a 2s . c om public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { Route route = (Route) adapterView.getItemAtPosition(position); if (route != null) { Intent intent = new Intent(); intent.putExtra(RouteEntry._ID, route.getId()); setResult(RESULT_OK, intent); finish(); } mPosition = position; } }); LocalBroadcastManager.getInstance(this).registerReceiver(deleteItemMessageReceiver, new IntentFilter(DELETE_ROUTE)); }