You have to expect a slight initial culture shock on a backpacking trip to unknown countries. For this not to be too serious, you should already inform about the culture of your planned travel destinations, before you start your journey.
Especially the first days in a foreign country are the hardest, because you will have to deal with everything at once – different time zone, different climate, unknown food, foreign language, and completely different customs.
It is best to spend the days quietly and do it like me: first stay a few days in the same hostel, and watch your surroundings. How do people dress? Is it okay to walk around shoulder or knee-free, or should you better cover them? Just find out how the locals do it and then do the same. This way, you can avoid a bigger faux pas.
Also get tips from other travelers in the hostel, who may have been traveling longer, and talk to the hostel staff. Be open to new things and show respect for other traditions and behaviors.
Here are my most important findings in terms of customs and culture in Africa:
If you commit a small faux pas, do not worry about it, and just take it with humor. A lovely smile usually causes miracles to happen. After all, you cannot do everything right.
For example, the whole restaurant laughed when Alex and I ate Ugali with both hands, because for locals, the left hand is the unclean one. In such situations you have to be able to laugh at yourself and stay relaxed.
What also stupidly happened to me was that I forgot to take off my shoes when I entered a house. I did not notice my mistake until the hostess looked critically at my feet. If you then respond with an innocent smile and apologize, the situation is almost certainly saved.