hehonghui / hehonghui/AndroidEventBus

fragment中使用订阅方法的问题

Open
#21 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.6k
Forks
390
PR merge metrics
No merged PRs in 30d

Description

如果我有一个fragment中添加一个订阅方法,fragment里面有个请求去拿数据,成功之后使用eventBus将数据post出来
现在我有一个activity,activity里面通过viewpager添加了刚才fragment的3个实例,
这个时候就会每一个fragment都能接收到3次post回来的数据,这样会有问题

所以请问eventbus针对这种fragment重用切当前页面有同一个class的多个实例的情况,post出来怎么区分呢

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the event subscription and posting API in the context of the Activity's ViewPager and its three Fragment instances. Determine whether events can be scoped to a specific Fragment instance; done means the repeated delivery behavior and a supported way to distinguish recipients are documented or addressed.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.