Android : works in Eclipse, not work in the phone

on Monday, September 8, 2014



//test.java


................

final ImageView imageView = (ImageView)findViewById(R.id.imageViewKv);//picture imageView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) {

imageView.buildDrawingCache(); Bitmap image= imageView.getDrawingCache(); Bundle extras = new Bundle(); extras.putParcelable("imagebitmap", image); Intent intent = new Intent(test.this,MyFullView.class);

intent.putExtras(extras); startActivity(intent);

return true; } });


which displays



//////////////////////////////////////////
//MyFullView.java

public class MyFullView extends Activity {

ImageView mImageView;
PhotoViewAttacher mAttacher; //PhotoViewAttacher

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.full_view);//full_view.xml

final ImageView imageView = (ImageView)findViewById(R.id.imageView); //picture

Bundle extras = getIntent().getExtras();
Bitmap bmp = (Bitmap) extras.getParcelable("imagebitmap");//Set the bitmap displayed
imageView.setImageBitmap(bmp);

// Attach a PhotoViewAttacher, which takes care of all of the zooming functionality.
mAttacher = new PhotoViewAttacher(imageView);

//the idea here is to show a picture
}

}


full_view



<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/black" >

<ImageView
android:id="@+id/imageView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="centerCrop" >

</ImageView>
</FrameLayout>


phone MyFullView does not open in Eclipse everything works fine


0 comments:

Post a Comment