Question: I want for the click on the item menu, this item will change the icon.

Selector for the item:

button\_add\_to\_wishlist.xml

```
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
    android:state_checked="false"
    android:drawable="@drawable/ic_add_fav" />
<item
    android:state_checked="true"
    android:drawable="@drawable/ic_add_fav_fill" />

```

Menu

```
<item
    android:id="@+id/add_to_wishlist"
    android:title="@string/book_btn_text_add_to_wishlist"
    android:icon="@drawable/button_add_to_wishlist"
    android:checkable="true"
    app:showAsAction="always"/>

```

Answer: 
There is no command to tell Amazon S3 to archive a specific object to Amazon Glacier. Instead, [Lifecycle Rules](https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) are used to identify objects.

The [Lifecycle Configuration Elements](https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html) documentation shows each rule consisting of:

* **Rule metadata** that include a rule ID, and status indicating whether the rule is enabled or disabled. If a rule is disabled, Amazon S3 will not perform any actions specified in the rule.
* **Prefix** identifying objects by the key prefix to which the rule applies.
* One or more **transition/expiration actions with a date or a time period** in the object's lifetime when you want Amazon S3 to perform the specified action.

The only way to identify *which* objects are transitioned is via the **prefix** parameter. Therefore, you would need to specify a separate rule for each object. (The prefix can include the full object name.)

However, there is a **limit of 1000 rules** per lifecycle configuration.

Yes, you could move objects one-at-a-time to Amazon Glacier, but this would actually involve uploading archives to Glacier rather than 'moving' them from S3. Also, be careful -- there are **higher 'per request' charges for Glacier than S3** that might actually cost you more than the savings you'll gain in storage costs.

In the meantime, consider using [Amazon S3 Standard - Infrequent Access storage class](https://aws.amazon.com/s3/storage-classes/), which can **save around 50% of S3 storage costs** for infrequently-accessed data.
You can programmatically archive a specific object on S3 to Glacier using [Lifecycle Rules](https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) (with a prefix of the exact object you wish to archive).

There is a [PUT lifecycle](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html) API. This API replaces the *entire* lifecycle configuration, so if you have rules outside of this process you will need to add them to each lifecycle you upload. If you want to archive specific files, you can either:

* For each file, create a lifecycle with one rule, wait until the file has transferred, then do the same for the next file
* Create a lifecycle configuration with one rule per file

The second will finish faster (as you do not need to wait between files), but requires that you know all the files you want to archive in advance.

There is a limit of 1,000 rules per lifecycle configuration, so if you have an awful lot of files that you want to archive, you will need to split them into separate lifecycle configurations.