当前位置: 首页>>代码示例>>Java>>正文


Java SimpleAdapter.notifyDataSetChanged方法代码示例

本文整理汇总了Java中android.widget.SimpleAdapter.notifyDataSetChanged方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleAdapter.notifyDataSetChanged方法的具体用法?Java SimpleAdapter.notifyDataSetChanged怎么用?Java SimpleAdapter.notifyDataSetChanged使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.SimpleAdapter的用法示例。


在下文中一共展示了SimpleAdapter.notifyDataSetChanged方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onGetInputtips

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
@Override
    public void onGetInputtips(List<Tip> tipList, int rCode) {
        if (rCode == AMapException.CODE_AMAP_SUCCESS) {
            List<HashMap<String, String>> listString = new ArrayList<>();
            for (int i = 0; i < tipList.size(); i++) {
                HashMap<String, String> map = new HashMap<>();
                map.put("name", tipList.get(i).getName());
                map.put("address", tipList.get(i).getDistrict());
                listString.add(map);
            }
            SimpleAdapter aAdapter = new SimpleAdapter(this, listString, R.layout.item_find_city_search,
                    new String[]{"name", "address"}, new int[]{R.id.poi_name, R.id.poi_address});

            mSearchText.setAdapter(aAdapter);
            aAdapter.notifyDataSetChanged();
            mSearchText.setOnItemClickListener((adapterView, view, position, id) -> {
                mSearchText.setText(listString.get(position).get("name"));
                Intent intent = new Intent();
                intent.putExtra(Constants.ARG_POIITEM, listString.get(position).get("name"));
                setResult(RESULTCODE, intent);
//                finish();
                showToast(listString.get(position).get("name"));
            });
        } else {
            ToastUtils.showToast(this.getApplicationContext(), String.valueOf(rCode));
        }
    }
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:PoiAroundSearchActivity.java

示例2: onSuccess

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
public void onSuccess(API api, int action, Map<String, Object> result) {
    ArrayList<Map<String, Object>> res = forceCast(result.get("result"));
    SimpleAdapter adapter = new SimpleAdapter(this, res, R.layout.view_exchange_currency_item,
            new String[]{"code", "name"}, new int[]{R.id.tvCurrencyCode, R.id.tvCurrencyName});
    lvResult.setAdapter(adapter);
    adapter.notifyDataSetChanged();
}
 
开发者ID:stytooldex,项目名称:stynico,代码行数:8,代码来源:QueryAllCurrency.java

示例3: onActivityResult

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
protected void onActivityResult (int requestCode, int resultCode, Intent data) 
{
	super.onActivityResult(requestCode, resultCode, data);
	if (resultCode == Activity.RESULT_OK) {
           ContentResolver reContentResolverol = getContentResolver();
            Uri contactData = data.getData();
            @SuppressWarnings("deprecation")
           Cursor cursor = managedQuery(contactData, null, null, null, null);
            cursor.moveToFirst();
            name = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
           String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID));
           Cursor phone = reContentResolverol.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, 
                    null, 
                    ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, 
                    null, 
                    null);
            while (phone.moveToNext()) {
                number = phone.getString(phone.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));	      
                }
            isfrist=false;
          //add a contact  
            db.open(); 
            long id = db.insertContact(name, number);
    		if(isfrist !=true)
    		{	
    			//get a contact  
    	        db.open();
    	       Cursor a = db.getContact(id);
    	       
    	        if (a.moveToLast()){
     			 Map<String, Object> map = new HashMap<String, Object>();
     	            map.put("contacts_name", name);
     	            map.put("contacts_num", number);
     	            dataList.add(map);
     	            simpleadapter = new SimpleAdapter(this, dataList, R.layout.contact_text, new String[]{"contacts_name","contacts_num"}, 
     		 				new int[]{R.id.contacts_name,R.id.contacts_num});
     	            listView.setAdapter(simpleadapter);  
     	            simpleadapter.notifyDataSetChanged();
    	           // DisplayContact(a);
    	            
    	        }
    	        else 
    	            Toast.makeText(this, "No contact found!", Toast.LENGTH_SHORT).show(); 
    		}
    		db.close(); 
	}
            
 }
 
开发者ID:Edward7Zhang,项目名称:oneKey2Alarm,代码行数:49,代码来源:contacts.java

示例4: onCreateView

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

	View view = inflater.inflate(R.layout.fr_json_request, container,false);

	carDataList = new ArrayList<Map<String, String>>();

	lvCar = (ListView) view.findViewById(R.id.lv_car);
	adapter = new SimpleAdapter(getActivity(), carDataList, R.layout.fr_json_request_list_item, keys, ids);
	lvCar.setAdapter(adapter);

	// 发起请求

	JsonObjectRequest request = new JsonObjectRequest(StringUtil.preUrl(Constants.DEFAULT_JSON_REQUEST_URL), null,
			new Listener<JSONObject>() {

				@Override
				public void onResponse(JSONObject response) {
					try {
						if (!response.has("result")) {
							return;
						}

						JSONObject result = response.getJSONObject("result");

						if (!result.has("fctlist")) {
							return;
						}

						JSONArray factoryArray = result.getJSONArray("fctlist");

						if (factoryArray.length() == 0) {
							return;
						}

						JSONObject factory = factoryArray.getJSONObject(0);

						if (!factory.has("serieslist")) {
							return;
						}

						JSONArray seriesArray = factory.getJSONArray("serieslist");

						carDataList.clear();

						for (int i = 0; i < seriesArray.length(); i++) {
							JSONObject series = seriesArray.getJSONObject(i);
							Map<String, String> seriesMap = new HashMap<String, String>();

							seriesMap.put("name", series.getString("name"));
							seriesMap.put("level", "级别:"+series.getString("levelname"));
							seriesMap.put("price", "价格:"+series.getString("price"));

							carDataList.add(seriesMap);

						}
						
						adapter.notifyDataSetChanged();

					} catch (Exception e) {
						ToastUtil.showToast(getActivity(), getResources().getString(R.string.request_fail_text));
					}

				}
			}, new ErrorListener() {

				@Override
				public void onErrorResponse(VolleyError arg0) {
					ToastUtil.showToast(getActivity(), getResources().getString(R.string.request_fail_text));
				}
			});
	// 请求加上Tag,用于取消请求
	request.setTag(this);

	VolleyUtil.getQueue(getActivity()).add(request);

	return view;
}
 
开发者ID:xulailing,项目名称:android-open-project-demo-master,代码行数:79,代码来源:JsonRequestFragment.java

示例5: onCreate

import android.widget.SimpleAdapter; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	requestWindowFeature(Window.FEATURE_NO_TITLE);// ȡ��������
	setContentView(R.layout.cjlistinfo);
	// ��׿�汾����4.4����Ϊ����ʽ״̬��
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
		SystemBartint.setTranslucentStatus(true, ListInfo.this);
	}
	SystemBarTintManager tintManager = new SystemBarTintManager(this);
	tintManager.setStatusBarTintEnabled(true);
	tintManager.setStatusBarTintColor(Color.parseColor("#2B78E4"));

	// ��ȡ���
	listview = (ListView) findViewById(R.id.listView1);
	listview.setVerticalScrollBarEnabled(false);// ���ع�����
	String inforesult = showinfo(url);
	if (!inforesult.equals("erro")) {
		char result[] = new char[inforesult.length() - 1];
		for (int i = 0; i < result.length; i++) {
			if (inforesult.charAt(i) == '*') {
				result[i] = '\n';
			}

			else {
				result[i] = inforesult.charAt(i);
			}
		}
		inforesult = new String(result);// char������Ϊ���캯��������ֵ

		String data[] = inforesult.split("\n");
		ArrayList<HashMap<String, Object>> listinfo = new ArrayList<HashMap<String, Object>>();
		for (int i = 0; i < data.length; i++) {
			HashMap<String, Object> map = new HashMap<String, Object>();
			String data2[] = data[i].trim().split(" ");
			map.put("kc_name", data2[0]);
			map.put("kc_teacher", data2[1]);
			map.put("kc_cj", data2[2]);
			listinfo.add(map);
		}
		SimpleAdapter adapter = new SimpleAdapter(this, listinfo,
				R.layout.cj, new String[] { "kc_name", "kc_teacher",
						"kc_cj" }, new int[] { R.id.kc_name,
						R.id.kc_teacher, R.id.kc_cj });
		listview.setAdapter(adapter);
		adapter.notifyDataSetChanged();
	} else {
		Intent intent = new Intent(ListInfo.this, ListInfo_Null.class);
		startActivity(intent);
	}

}
 
开发者ID:rocrocflying,项目名称:PersonalMarkManage,代码行数:53,代码来源:ListInfo.java


注:本文中的android.widget.SimpleAdapter.notifyDataSetChanged方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。