小编Mob*_*ast的帖子

无法在android中的活动之间传递位图

我需要通过从其他活动中选择图像来动态更改活动的背景.并将所选图像传递回调用活动,但是当我尝试获取图像时,它为空.这是我的代码.

  public class SelectGoalBackground extends OrmLiteBaseActivity<DatabaseHelper> {// implements{



GridView gridview ;
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.select_goal_background);
   final String from = getIntent().getExtras().getString("from");
    goalsList = new ArrayList<Goal>();

    try {
        goalsList = getTop3Goals();
    } catch (SQLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    } catch (java.sql.SQLException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }


     gridview = (GridView) findViewById(R.id.gridview);
    gridview.setAdapter(new ImageAdapter(this));

    gridview.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

           ImageView l = (ImageView)gridview.getChildAt(position);
              Drawable …
Run Code Online (Sandbox Code Playgroud)

android bitmap drawable

3
推荐指数
1
解决办法
3874
查看次数

标签 统计

android ×1

bitmap ×1

drawable ×1