Attempting to keep your dog happy whenever you live in an apartment might be difficult. A bored dog is not very good for either you or the dog. When having nothing to do they tend to act out and chew and shred things like your favorite couch or shoes. Lack of exercise causes obesity, bone issues, heart disease, and emotional complications. When your dog is well exercised and happy then he is a much better companion for you.
A general rule of thumb would be to exercise your dog between 15 - 30 minutes a day. Even now and then they will require more than that. For much younger dogs, they usually will need more activity. For much more active dogs that have trouble sleeping, an enjoyable game of fetch or tug-o-war might be a good method to tire your dog just prior to going to bed.
For mental stimulation, a hollow chew toy filled with a glop of peanut butter can keep a dog occupied (freezing it amps the lifespan, as they really have to work at it). Many commercial toys also permit tough treats to be hidden inside. It is possible to also try playing hide & seek by putting snacks around the apartment and letting him find them.
If chewing is a problem for your dog then be sure to stock up on nylon bones or natural beef knuckle bones that will give your pup hours of enjoyment without ruining your shoes. Be sure to avoid bones that splinter as it can harm your dog. Avoid plushies or articles of clothingdogs cannot distinguish between old and new.
When you have one near your apartment, the best method to burn off energy would be to take your dog to a dog park. Here you can let your pup off leash and if yours is "dog friendly", he can play freely with other dogs. Only 30 minutes at a park can tire your dog out far more than hours of walking. In that exact same vein, an apartment dog that continues to be miserable during the day would benefit from an occasional outing to doggie daycare.