List of usage examples for android.widget ListView setAdapter
@Override public void setAdapter(ListAdapter adapter)
From source file:com.cuddlesoft.nori.fragment.TagListDialogFragment.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Extract data from the arguments bundle. image = getArguments().getParcelable(BUNDLE_ID_IMAGE); settings = getArguments().getParcelable(BUNDLE_ID_SEARCH_CLIENT_SETTINGS); // Create and initialize the ListView. final ListView listView = new ListView(getActivity()); listView.setOnItemClickListener(this); listView.setAdapter(new TagListAdapter()); return new AlertDialog.Builder(getActivity()).setView(listView) .setPositiveButton(R.string.dialog_tags_closeButton, new DialogInterface.OnClickListener() { @Override// ww w .j av a 2s .c om public void onClick(DialogInterface dialogInterface, int i) { dismiss(); } }).create(); }
From source file:com.fallahpoor.infocenter.fragments.StorageFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_storage, container, false); mIsApiAtLeast18 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2; ListView listView = (ListView) view.findViewById(R.id.listView); listView.setAdapter(new CustomArrayAdapter(getActivity(), getListItems())); return view;// w w w .j a v a2 s .c o m }
From source file:org.kepennar.android.client.social.facebook.FacebookActivity.java
private void showFacebookOptions() { String[] options = { "Disconnect", "Profile", "Home Feed", "Wall Post" }; ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, options);//from w w w. j av a 2 s .c o m ListView listView = (ListView) this.findViewById(R.id.facebook_activity_options_list); listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parentView, View childView, int position, long id) { Intent intent; switch (position) { case 0: disconnect(); showConnectOption(); break; case 1: intent = new Intent(); intent.setClass(parentView.getContext(), FacebookProfileActivity.class); startActivity(intent); break; case 2: intent = new Intent(); intent.setClass(parentView.getContext(), FacebookHomeFeedActivity.class); startActivity(intent); break; case 3: intent = new Intent(); intent.setClass(parentView.getContext(), FacebookWallPostActivity.class); startActivity(intent); break; default: break; } } }); }
From source file:com.skubit.android.transactions.TransactionsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.wallet_transactions_fragment, null); TextView balanceLabel = (TextView) view.findViewById(R.id.wallet_balance_label); balanceLabel.setTypeface(FontManager.CONDENSED_REGULAR); mBalance = (TextView) view.findViewById(R.id.wallet_balance); ListView list = (ListView) view.findViewById(R.id.list); list.setAdapter(mAdapter); list.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/* w w w. ja v a 2s.c o m*/ public void onItemClick(AdapterView<?> adapter, View arg1, int position, long arg3) { TransactionDto transactionDto = (TransactionDto) adapter.getItemAtPosition(position); ObjectMapper mapper = new ObjectMapper(); String value; try { value = mapper.writeValueAsString(transactionDto); startActivity(TransactionDetailsActivity.newIntent(value, getActivity().getPackageName())); } catch (JsonProcessingException e) { e.printStackTrace(); } } }); return view; }
From source file:com.imobilize.blogposts.articles.ArticlesManager.java
private Listener<JSONArray> listener(final Context articlesContext, final ListView articlesListView) { return new Listener<JSONArray>() { @Override/*from w ww .jav a 2 s. c o m*/ public void onResponse(JSONArray response) { articlesListView.setAdapter(new ArticlesArrayAdapter(articlesContext, response)); } }; }
From source file:com.damianhinch.sunshine.ForecastFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // The CursorAdapter will take data from our cursor and populate the ListView. mForecastAdapter = new ForecastAdapter(getActivity(), null, 0); View rootView = inflater.inflate(R.layout.fragment_main, container, false); // Get a reference to the ListView, and attach this adapter to it. ListView listView = (ListView) rootView.findViewById(R.id.listview_forecast); listView.setAdapter(mForecastAdapter); // We'll call our MainActivity listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override/*from ww w . j ava2 s . c o m*/ public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { // CursorAdapter returns a cursor at the correct position for getItem(), or null // if it cannot seek to that position. Cursor cursor = (Cursor) adapterView.getItemAtPosition(position); if (cursor != null) { String locationSetting = Helpers.getUserPreferredLocation(getActivity()); Intent intent = new Intent(getActivity(), DetailView.class).setData(WeatherContract.WeatherEntry .buildWeatherLocationWithDate(locationSetting, cursor.getLong(COL_WEATHER_DATE))); startActivity(intent); } } }); return rootView; }
From source file:com.fallahpoor.infocenter.fragments.ComponentsFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View view = inflater.inflate(R.layout.fragment_components, container, false); ListView listView = (ListView) view.findViewById(R.id.listView); listView.setOnItemClickListener(new ComponentClickListener()); listView.setAdapter(new CustomArrayAdapter(getActivity(), getListItems())); return view;//from w ww . j a va 2 s . c o m }
From source file:org.kepennar.android.client.social.twitter.TwitterActivity.java
private void showTwitterOptions() { String[] options = { "Disconnect", "View Profile", "Timeline", "Tweet", "Direct Message" }; ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, options);/*from w ww .j a v a2 s . c o m*/ ListView listView = (ListView) this.findViewById(R.id.twitter_activity_options_list); listView.setAdapter(arrayAdapter); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { public void onItemClick(AdapterView<?> parentView, View childView, int position, long id) { Intent intent; switch (position) { case 0: disconnect(); showConnectOption(); break; case 1: intent = new Intent(); intent.setClass(parentView.getContext(), TwitterProfileActivity.class); startActivity(intent); break; case 2: intent = new Intent(); intent.setClass(parentView.getContext(), TwitterTimelineActivity.class); startActivity(intent); break; case 3: intent = new Intent(); intent.setClass(parentView.getContext(), TwitterTweetActivity.class); startActivity(intent); break; case 4: intent = new Intent(); intent.setClass(parentView.getContext(), TwitterDirectMessageActivity.class); startActivity(intent); break; default: break; } } }); }
From source file:com.androidhacks7.apprtc_android.RegistrationActivity.java
private void updateUI(final ArrayList<String> userNames) { ListView listView = (ListView) findViewById(R.id.userList); listView.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, userNames)); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override// w w w .j a va2 s. c o m public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { Log.d(TAG, "Initiating call to " + userNames.get(i)); Intent intent = new Intent(RegistrationActivity.this, VideoCallActivity.class); JSONObject jsonObject = new JSONObject(); try { jsonObject.put(JSONConstants.CALLER, currentUser); jsonObject.put(JSONConstants.RECEIVER, userNames.get(i)); } catch (JSONException e) { e.printStackTrace(); } intent.putExtra(JSONConstants.MAKE_CALL, true); intent.putExtra(JSONConstants.CALL_PARAMS, jsonObject.toString()); startActivity(intent); finish(); } }); }
From source file:com.aevi.simpleexample.SecureCommunicationsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_https_example); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, consoleLines); ListView console = (ListView) findViewById(R.id.consoleView); console.setAdapter(adapter); setupSearchTextEnterListener();/*from w ww. j a v a 2 s .c o m*/ progressBarVisible(false); }