本文整理匯總了Java中android.widget.ArrayAdapter.clear方法的典型用法代碼示例。如果您正苦於以下問題:Java ArrayAdapter.clear方法的具體用法?Java ArrayAdapter.clear怎麽用?Java ArrayAdapter.clear使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ArrayAdapter
的用法示例。
在下文中一共展示了ArrayAdapter.clear方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onReceive
import android.widget.ArrayAdapter; //導入方法依賴的package包/類
@SuppressLint("UseValueOf")
public void onReceive(Context c, Intent intent) {
ArrayAdapter arrayAdapter = crossfadePageTransformer.getAdapter();
if (arrayAdapter != null) {
arrayAdapter.clear();
arrayAdapter.addAll(getWifiNetworks());
arrayAdapter.notifyDataSetChanged();
}
}
示例2: updateAyahSpinner
import android.widget.ArrayAdapter; //導入方法依賴的package包/類
private void updateAyahSpinner(QuranSpinner spinner,
ArrayAdapter<CharSequence> adapter,
int maxAyah, int currentAyah) {
final Context context = getActivity();
if (context != null) {
CharSequence[] ayahs = new String[maxAyah];
for (int i = 0; i < maxAyah; i++) {
ayahs[i] = QuranUtils.getLocalizedNumber(context, (i + 1));
}
adapter.clear();
for (int i = 0; i < maxAyah; i++) {
adapter.add(ayahs[i]);
}
spinner.setSelection(currentAyah - 1);
}
}
示例3: onRefreshComplete
import android.widget.ArrayAdapter; //導入方法依賴的package包/類
/**
* When the AsyncTask finishes, it calls onRefreshComplete(), which updates the data in the
* ListAdapter and turns off the progress bar.
*/
private void onRefreshComplete(List<String> result) {
Log.i(LOG_TAG, "onRefreshComplete");
// Remove all items from the ListAdapter, and then replace them with the new items
ArrayAdapter<String> adapter = (ArrayAdapter<String>) getListAdapter();
adapter.clear();
for (String cheese : result) {
adapter.add(cheese);
}
// Stop the refreshing indicator
setRefreshing(false);
}