Romantic Context (Most Common): In everyday conversation, on social media (like Weibo and Douyin), and in pop culture (songs, TV dramas), `前任` almost always refers to an ex-partner. It's a gender-neutral term, applying to both ex-boyfriends and ex-girlfriends. The connotation is often slightly melancholic, dramatic, or a source of gossip.
Professional/Formal Context: In the workplace, news reports, or political discussions, `前任` refers to the person who previously held a position. For example, “the former CEO,” “the previous manager,” or “the last president.” This usage is formal and objective.
Determining the Meaning: The context is your only guide. If the conversation is about dating, love, or personal history, it's an “ex.” If it's about a company, government, or a specific job title, it's a “predecessor.”