我在Java中使用public class ViewPagerAdapter extends PagerAdapter {
// Declare Variables
Context context;
String[] where;
String[] date;
String[] information;
int[] flag;
LayoutInflater inflater;
public ViewPagerAdapter(Context context, String[] where, String[] date,
String[] information, int[] flag) {
this.context = context;
this.where = where;
this.date = date;
this.information = information;
this.flag = flag;
}
@Override
public int getCount() {
return where.length;
}
@Override
public boolean isViewFromObject(View view, Object object) {
return view == ((RelativeLayout) object);
}
@Override
public Object instantiateItem(ViewGroup container, int position) {
// Declare Variables
TextView txtrank;
TextView txtcountry;
TextView txtpopulation;
ImageView imgflag;
inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View itemView = inflater.inflate(R.layout.styledeets, container,
false);
// Locate the TextViews in viewpager_item.xml
txtrank = (TextView) itemView.findViewById(R.id.date);
txtcountry = (TextView) itemView.findViewById(R.id.where);
txtpopulation = (TextView) itemView.findViewById(R.id.info);
// Capture position and set to the TextViews
txtrank.setText(where[position]);
txtcountry.setText(date[position]);
txtpopulation.setText(information[position]);
// Locate the ImageView in viewpager_item.xml
imgflag = (ImageView) itemView.findViewById(R.id.photo);
// Capture position and set to the ImageView
imgflag.setImageResource(flag[position]);
// Add viewpager_item.xml to ViewPager
((ViewPager) container).addView(itemView);
return itemView;
}
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
((ViewPager) container).removeView((RelativeLayout) object);
}
}
语句时遇到此错误:
TRUNCATE TABLE
这是我的Java代码:
java.sql.SQLException: Operation 'TRUNCATE TABLE'
cannot be performed on object 'PULLOUT' because there
is an open ResultSet dependent on that object.