android 数组数据绑定到listview
package com.zxl; import android.app.ListActivity; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.Toast; public class MainActivity extends ListActivity { /** Called when the activity is first created. */ String[] presidentsStrings={ "h", "o", "fd", "fe", "t", "h", "hr", "fa" }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); setListAdapter(new ArrayAdapter<String>(this,android.R.layout.易做图_list_item_1,presidentsStrings)); } public void onListItemClick( ListView parent,View v,int position,long id){ Toast.makeText(this,"item is "+presidentsStrings[position],Toast.LENGTH_LONG).show(); } }
补充:移动开发 , Android ,