我的activity跳转传值成功啦 但是在那个新页面上不停留 一闪就有跳走到别的页面啦 不知道是怎么回事
以下是我 的程序
public class ShowPicActivity extends Activity {
private ImageView reView;
private String pictureId;
private Button next;
private Button last;
private Button share;
private Button delete;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_pic);
reView=(ImageView)findViewById(R.id.sView);
Intent intent = getIntent();
Bundle data = intent.getExtras();
pictureId = data.getString("pictureId");
System.out.println("跳转接受pictureId-----------------------"+pictureId);
readPictureTask read=new readPictureTask();
read.doInBackground();
next=(Button)findViewById(R.id.next);
last=(Button)findViewById(R.id.last);
delete=(Button)findViewById(R.id.delete);
share=(Button)findViewById(R.id.share);
}
class readPictureTask extends AsyncTask<byte[], String, String>{
protected String doInBackground(byte[]... params) {
// TODO Auto-generated method stub
//创建文件
try{
//方法一
System.out.println("path1--------------------------");
Bitmap bmp = BitmapFactory.decodeFile(pictureId);
System.out.println("path2--------------------------");
@SuppressWarnings("deprecation")
BitmapDrawable bmpDraw=new BitmapDrawable(bmp);
System.out.println("path3--------------------------");
reView.setImageDrawable(bmpDraw);
System.out.println("path4--------------------------");
}catch(Exception e){
e.printStackTrace();
}
return null;
} }
}
以下是我 的程序
public class ShowPicActivity extends Activity {
private ImageView reView;
private String pictureId;
private Button next;
private Button last;
private Button share;
private Button delete;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_pic);
reView=(ImageView)findViewById(R.id.sView);
Intent intent = getIntent();
Bundle data = intent.getExtras();
pictureId = data.getString("pictureId");
System.out.println("跳转接受pictureId-----------------------"+pictureId);
readPictureTask read=new readPictureTask();
read.doInBackground();
next=(Button)findViewById(R.id.next);
last=(Button)findViewById(R.id.last);
delete=(Button)findViewById(R.id.delete);
share=(Button)findViewById(R.id.share);
}
class readPictureTask extends AsyncTask<byte[], String, String>{
protected String doInBackground(byte[]... params) {
// TODO Auto-generated method stub
//创建文件
try{
//方法一
System.out.println("path1--------------------------");
Bitmap bmp = BitmapFactory.decodeFile(pictureId);
System.out.println("path2--------------------------");
@SuppressWarnings("deprecation")
BitmapDrawable bmpDraw=new BitmapDrawable(bmp);
System.out.println("path3--------------------------");
reView.setImageDrawable(bmpDraw);
System.out.println("path4--------------------------");
}catch(Exception e){
e.printStackTrace();
}
return null;
} }
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货