If you want to cultivate a habit but you don't like the activity you are doing, you are merely forcing yourself to do it and should not be considered a habit. Its more like you are disciplined rather than a habit.
In my opinion, if you have a passion for an activity, eg: swimming twice a week, and you set priorities on it, that will automatically become a habit in the long run. You will feel a bit strange if you break the habit even for a week.
If you find yourself unable to continue the habit that you always have been doing, maybe its time to ask yourself whether you still have the "fire in you" to continue it.
Come to think of it.... if you have a habit of drinking coffee, it's because you LIKE coffee. If you have a habit of being playing basketball weekly, its because you LIKE basketball. Isn't it?
