-5

I'm trying to use a bundle. But the code gives me some errors.. The paramBundle.open returns with an error : cannot resolve method open(), the method close() does the same for me. The AnimationGetNewNumber method cant be resolved either. What am I doing wrong ?

 protected void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    setContentView(R.layout.activity_add_edit_animation);
    getIntent().getExtras();
    if (getIntent().getExtras().getInt("AEA_INT_ACTION", 0) == 0)
    {
        Bundle bundle= new Bundle(paramBundle);
        paramBundle.open();
        this.animationNumber = paramBundle.AnimationGetNewNumber();
        paramBundle.close();
    }
    for (;;)
    {
        this.gridView = ((GridView)findViewById(R.id.gridviewAddEdit));
        this.gridView.setChoiceMode(1);
        this.imageAdapter = new ImageAdapter(this, this.animationNumber);
        this.gridView.setAdapter(this.imageAdapter);
        this.gridView.setOnItemClickListener(this);
        this.gridView.setOnItemLongClickListener(this);
        return;
        this.animationNumber = getIntent().getExtras().getInt("AEA_INT_NUMBER", 0);
    }
}
Bas
  • 13
  • 3

2 Answers2

1

Bundle does not have a method named open(), nor a method named close(), nor a method named AnimationGetNewNumber(). You can't call methods that doesn't exist.

Karakuri
  • 38,365
  • 12
  • 84
  • 104
0

You want to retreive data from saved instace bundle then make use of following method in your activity.

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
  super.onRestoreInstanceState(savedInstanceState);

  this.animationNumber = savedInstanceState.AnimationGetNewNumber();//your code of retriving data from bundle

  Log.i("debug", "saved data: " + myString);
}

Note: there is no open() and close() method for bundle instace.

Ketan
  • 423
  • 3
  • 12