Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 查看寻呼机不显示图像_Android_Android Fragments - Fatal编程技术网

Android 查看寻呼机不显示图像

Android 查看寻呼机不显示图像,android,android-fragments,Android,Android Fragments,这是我的网格视图,它是通过使用意图查看寻呼机类的通行位置` public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub int pos = 0; LayoutInflater inflater = ((Activity) m1Context) .getLayoutI

这是我的网格视图,它是通过使用意图查看寻呼机类的通行位置`

public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        int pos = 0;
        LayoutInflater inflater = ((Activity) m1Context)
                .getLayoutInflater();
        View customRow1 = inflater.inflate(R.layout.gview, null);
        ImageView image = (ImageView) customRow1
                .findViewById(R.id.imageforgrid);
        switch (gotbread) {
        case 0:

            image.setImageResource(images2[pos]);
            break;
        case 1:
            image.setImageResource(images1[position]);
            break;
        }
        image.setAdjustViewBounds(true);
        image.setScaleX((float) 0.5);
        image.setScaleY((float) 0.5);
        image.setOnClickListener(new OnImageClickListener(position));
        return customRow1;
    }
}

class OnImageClickListener implements OnClickListener {

    int _postion;

    // constructor
    public OnImageClickListener(int position) {
        this._postion = position;
    }

    @Override
    public void onClick(View v) {
        // on selecting grid view image
        // launch full screen activity
        Bundle basket=new Bundle();
        basket.putInt("position",_postion);
        Intent i = new Intent(Customgrid.this,
                FullScreenImageActivity.class);
        i.putExtras(basket);
        startActivity(i);
    }

}
}

`

这是在swip视图中显示图像的视图寻呼机…但它不是在全屏视图中显示图像..它没有显示任何错误,但它只是黑屏显示,没有任何图像

public class FullScreenImageActivity extends Activity {

int gotbiscuit;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.fullscreen_view);
    ViewPager viewpager = (ViewPager) findViewById(R.id.pager);
    Intent i = getIntent();
    int gotbiscuit = i.getExtras().getInt("position");
     System.out.print(gotbiscuit);
    Fullscreenimage adapter = new Fullscreenimage(
            FullScreenImageActivity.this);

    viewpager.setAdapter(adapter);

    // displaying selected image first
    viewpager.setCurrentItem(gotbiscuit);
}

public class Fullscreenimage extends PagerAdapter {
    public Integer[] images1 = { R.drawable.s_1, R.drawable.s_2, R.drawable.s_3 };

    public Context mContext;


    public Fullscreenimage(Context context) {
        super();
        this.mContext = context;

        // TODO Auto-generated constructor stub
    }

    @Override
    public int getCount() {
        // TODO Auto-generated method stub
        return images1.length;
    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        // TODO Auto-generated method stub
        super.destroyItem(container, position, object);
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        // TODO Auto-generated method stub
        LayoutInflater inflater = ((Activity) mContext).getLayoutInflater();
        View viewlayout = inflater.inflate(R.layout.layout_fullscreen_view,
                container, false);
        ImageView imageview = (ImageView) viewlayout
                .findViewById(R.id.imgDisplay);
        imageview.setImageResource(images1[gotbiscuit]);
        ((ViewPager) container).addView(viewlayout, 0);
        return viewlayout;

    }
}
}