请先查看我的问题:
RecUPC=(case isnull(tm2.TranslationCriteria2,'') when '' then tm.TranslationCriteria2
else (Case isnull(tm.TranslationCriteria2,'') when '' then rec.UPC end) end),
如果在tm2
或tm
或rec
的别名中找到UPC,我会尝试获取UPC。但它显示的大多数值为NULL
,其中tm2
包含大部分值。
所以我怀疑的是,当我进入NULL
时,我会得到 public class MainActivity extends FragmentActivity {
public static TextView tx;
CustomViewPager pager1;
List<Fragment> fragments1;
public PagerAdapter adapter1;
ArrayList<String> image = new ArrayList<String>() {{
add("0");
add("1");
add("2");
add("3");
add("4");
}};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.text);
pager1 = (CustomViewPager) findViewById(R.id.pager1);
fragments1 = getFragments1();
adapter1 = new PagerAdapter(getSupportFragmentManager(), fragments1);
pager1.setAdapter(adapter1);
removeView1(1);
adapter1.notifyDataSetChanged();
pager1.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
MyImageSlider fragmntDta = (MyImageSlider ) findFragmentByPosition(mCurrentPos);
String value = fragmntDta.getTextOnTextView();
Toast toast = Toast.makeText(getApplicationContext(),"Text is " +value, Toast.LENGTH_SHORT);
toast.show();
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
}
public void removeView1 (int position)
{
adapter1.removeView1(pager1, position);
adapter1.notifyDataSetChanged();
}
public class PagerAdapter extends FragmentPagerAdapter {
private List<Fragment> fragments;
public PagerAdapter(FragmentManager fm, List<Fragment> fragments) {
super(fm);
this.fragments = fragments;
}
@Override
public Fragment getItem(int position) {
return this.fragments.get(position);
}
@Override
public int getCount() {
return this.fragments.size();
}
@Override
public int getItemPosition (Object object)
{
if (object instanceof MyImageSlider ) {
return POSITION_NONE;
}
return POSITION_UNCHANGED;
}
public int removeView1 (ViewPager pager, int position)
{
pager.setAdapter (null);
fragments.remove (position);
pager.setAdapter (this);
return position;
}
}
private List<Fragment> getFragments1() {
List<Fragment> fList = new ArrayList<Fragment>();
for (int i = 0; i < image.size(); i++) {
fList.add(MyImageSlider.newInstance(image.get(i)));
}
return fList;
}
public static class MyImageSlider extends Fragment {
String newid;
TextView textView;
public static MyImageSlider newInstance(String s)
{
MyImageSlider slider=new MyImageSlider();
Bundle b=new Bundle();
b.putString("newid", s);
slider.setArguments(b);
return slider;
}
public String getTextOnTextView(){
retrun textView.getText();
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
newid = getArguments().getString("newid");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.leftpager,container, false);
textView = (TextView)view.findViewById(R.id.text);
textView.setText(newid);
textView.setTag(newid);
return view;
}
}
public Fragment findFragmentByPosition(int position) {
MyImageSlider fragmentPagerAdapter = mAdapter;
return getSupportFragmentManager().findFragmentByTag("android:switcher:" + mHorizontalViewPager.getId() + ":" + fragmentPagerAdapter.getItemId(position));
}
}
。