# FuseViews ICallback ANR

**URL:** https://forums.fusetools.com/t/fuseviews-icallback-anr/4029
**Category:** General
**Created:** [June 4, 2017, 7:22pm UTC](https://forums.fusetools.com/t/fuseviews-icallback-anr/4029 "2017-06-04T19:22:32Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jesusmartinoza](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/jesusmartinoza/32/659_2.png) [@jesusmartinoza](https://forums.fusetools.com/u/jesusmartinoza)
#### Post date: [June 4, 2017, 7:22pm UTC](https://forums.fusetools.com/t/fuseviews-icallback-anr/4029/1 "2017-06-04T19:22:32Z")

</div>

Hi, I found a little problem with Android ICallBack and fat `module.exports` args. For example If I load this code:

```auto
<JavaScript>
var stores = Observable({
            "id": 4,
            "name": "Cycling Shop",
            "description": "La mas destacada tienda de ciclismo, con venta de repuestos y refacciones",
            "profile_image": "http://mydomain,com/img/stores/rueda-libre.jpg",
            "cover_image": "http://mydomain,com/img/stores/rueda-libre-bk.jpg",
            "category_image": "http://mydomain,com/img/categories/tiendas.png",
            "geo_lat": 22.156017,
            "geo_lng": -101.003913,
            "rating": 3,
            "followed": 9
        }, {
            "id": 57,
            "name": "Samba Smoothie",
            "description": "¡Productos naturales, nutritivos y especialmente balanceados para tus actividades diarias!",
            "profile_image": "http://mydomain.com/dynamic/branches/samba-smoothie/profile-image-57.jpg",
            "cover_image": "http://mydomain.com/dynamic/branches/samba-smoothie/cover-image-57.jpg",
            "category_image": "http://mydomain.com/img/categories/restaurantes.png",
            "geo_lat": 22.1478936,
            "geo_lng": -101.0260151,
            "rating": 0,
            "followed": 2
        }
       // ... and more and more stores
   );
}
module.exports = {
  stores : stores
};
</JavaScript>

<Button Clicked="{openStore}" />

```

Setting the ICallback from Java I get all the `module.exports` context and it’s painfully slow to trigger the event `openStore`. The problem is with key “data” of the hashMap(it could be a really long string). Is it possible via Java to hide the `data`key? 🙂

![DEBUG](https://preview.ibb.co/b7efiF/h.jpg)

---

<div class="post-metadata">

### Author: ![Uldis](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/uldis/32/657_2.png) [@Uldis](https://forums.fusetools.com/u/Uldis)
#### Post date: [June 5, 2017, 12:18pm UTC](https://forums.fusetools.com/t/fuseviews-icallback-anr/4029/2 "2017-06-05T12:18:45Z")

</div>

Hi jesusmartinoza,

an internal ticket has been raised to investigate the issue. You’ll get notified when there’s some news.

---

<div class="post-metadata">

### Author: ![Vegard\_Strand\_Lende](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/vegard_strand_lende/32/349_2.png) [@Vegard\_Strand\_Lende](https://forums.fusetools.com/u/Vegard_Strand_Lende)
#### Post date: [July 6, 2017, 2:59pm UTC](https://forums.fusetools.com/t/fuseviews-icallback-anr/4029/3 "2017-07-06T14:59:05Z")

</div>

Hi!

Thanks for reporting this issue. We have changed the API for callbacks to lazily load the arguments. The string in the `data` key is the datacontext from the callsite in UX. Since you are calling out to native code, fuse has to serialize all the data, which can be slow if you have lots of data on the datacontext. In commoncase you dont care about the arguments, but only for the callback itself.

The new API will look like this in Java:

```auto
ViewHandle view = ...;
view.setCallback("buttonClicked", new ICallback() {
    @Override
    public void invoke(IEventRecord eventRecord) {
    	// args is whatever described in https://www.fusetools.com/docs/scripting/scripting#binding-functions
    	HashMap<String,String> args = eventRecord.getArgs();
    	// data is the datacontext serialized to a JSON string
    	String data = eventRecord.getDataJson();
    }
});

```

The serialization will only happen if you call the get methods on `eventRecord`.

---

<div class="post-metadata">

### Author: ![jesusmartinoza](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/jesusmartinoza/32/659_2.png) [@jesusmartinoza](https://forums.fusetools.com/u/jesusmartinoza)
#### Post date: [July 7, 2017, 7:15am UTC](https://forums.fusetools.com/t/fuseviews-icallback-anr/4029/4 "2017-07-07T07:15:55Z")

</div>

Thank you for the replies! I will try.
