Assume that $f:A\to B$ is an injective and local homomorphism between two local rings. Let $\hat A$ and $\hat B$ be respectively the completions of $A$ and $B$ with respect the maximal ideals. Then we have an induced (continuous) homomorphism $\hat f:\hat A\to \hat B$;
Is $\hat f$ still injective? If yes, why?
This is not true. I will explain a counterexample.
Take $A = \bar{\mathbb{F}}_p[x,y]_{(x,y)}$. Now consider the ring $B'= \bar{\mathbb{F}}_p [\![ x,y]\!]$. By the countable prime avoidance lemma (see e.g. Pournaki, Theorem 1.1) the ring $B'$ contains uncountably many prime ideals of height $1$:
As $B'$ is an $UFD$, any element $f \in B'$ is contained in a height $1$ prime ideal (namely a principal one). Thus, $(x,y) \subseteq B'$ is contained in the union of all height $1$ primes. But certainly there is not a single height $1$ prime ideal already containing $(x,y)$. This shows that there must be uncountably many such height $1$ prime ideals as else we would have found a contradiction to the above lemma.
Next note that for $\mathfrak{p} \subseteq A$ a prime ideal of height $1$ there are at most finitely many $\mathfrak{p}' \subseteq B'$ of height $1$ such that $A \cap \mathfrak{p}' = \mathfrak{p}$:
Indeed, the ring $B'/\mathfrak{p}B'$ is noetherian of dimension $1$ and any such $\mathfrak{p}'$ is in $1$-to-$1$-correspondence with a minimal prime ideal of $B'/\mathfrak{p}B'$. But a noetherian ring only has a finite number of minimal prime ideals.
Note that $A$ only contains countably many ideals (because it is noetherian and only contains countably many elements). Therefore, we find (uncountably many, but in particular) one prime ideal $\mathfrak{p}' \subseteq B'$ of height $1$ in $B'$ such that $A \cap \mathfrak{p}'=0$.
Thus, take $B= B'/\mathfrak{p}'$. Certainly $B$ is $(x,y)$-complete and by construction the morphism $A \rightarrow B$ is injective. Completing $(x,y)$-adically, we obtain the canonical morphism $\hat{A}= B' \rightarrow B = \hat{B}$ which (again by construction) has the non-trivial kernel $\mathfrak{p}'$.