我想与纽芬兰人进行电网观测。 以下是主要页码。
GridView gridview1 = (GridView) findViewById(R.id.gridview);
gridview1.setAdapter(new Buttonadapter(this));
gridview1.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View arg1, int position, long id)
{
TextView temp=(TextView)arg1;
CharSequence temp2=temp.getText();
Intent myIntent = new Intent(arg1.getContext(), Diseasemain.class);
myIntent.putExtra("disease", temp2);
startActivityForResult(myIntent, 0);
}
});
这里是纽特人阶级守则。
public class Buttonadapter extends BaseAdapter {
private Context mContext;
public Buttonadapter(Context c)
{ mContext = c; }
public int getCount()
{ return mThumbIds.length; }
public Object getItem(int position)
{ return null; }
public long getItemId(int position)
{ return 0; } // create a new ImageView for each item referenced by the Adapter
public View getView(int position, View convertView, ViewGroup parent)
{ Button btn;
if (convertView == null)
{ // if it s not recycled, initialize some attributes
btn = new Button(mContext);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
}
});
btn.setLayoutParams(new GridView.LayoutParam(85,85));
btn.setPadding(8, 8, 8, 8);
}
else
{
btn = (Button) convertView;
}
btn.setText(mThumbIds[position]);
return btn; }
private String[] mThumbIds =
{
"hi",
"bye",
"heelo"
}
;}
每当我点击任何 but子时,就没有发射波克事件,也没有从下页开始。