Kill another application on Android?

I am try to kill my another application. But this code is not able to kill my another application. I know to kill another application is a bad idea. But I have a learning purpose, and I have tried to kill. My code part:

You can only kill a process that has the same userID as the one that is doing the killing. If you are trying to kill your own process it should work. Otherwise you can't do it (unless you have a rooted device and your application has root priviledges).