This answer recommends solar cells to recharge batteries. However, this likely works best during a layover day. I usually don't have those. For a nice-to-have situation, how well does it work to strap a solar cell/panel to the backpack to charge a set of batteries? When walking, the panel will not be optimally oriented toward the sun. Will I be able to charge a set of 2 rechargable AA batteries during a full day hiking in mountains on a sunny day at 50-55°N in September? What about a cloudy day?
The answer will vary widely for different types of solar panels. For example, some are not suitable for use while walking or can only charge via USB.
Solar cells have the highest power the more vertical the sun rays hit them. Around 50° N the optimum is around 30-40° between solar panel and horizon, being flatter in summer and steeper in winter. The best (fixed panels) would also have an orientation straight south.
The yearly average (and thus including winter and cloudy days) energy output for solar panels (mainly on rooftops) in Germany (around 50° N) is 700 - 1000 kWh (kilowatt-hours) per kW (kilowatt) peak power.
kWh is the amount of energy gathered, normalized to the power of the generator: kW peak. (The power of solar generators isn´t constant, it depends on sun radiation. But it is capped, it has a maximum for every device. This is the peak power of the panel/charger).
This number means, that on a completely average day you could probably harvest around 2-3 Wh per W peak power. A charger with 10 W power would therefore generate around 20-30 Wh of energy. On a cloudy day, you could be below this. The higher the temperature, the lower the efficiency of the panels. Cold sunny days are the best.
The capacity of AA batteries also depends on the concrete model. In my country, AA batteries normally are LR6, having a voltage of 1.5 V and up to 2500mAh/4Wh of capacity/energy. To load two of them on the above mentioned "perfect standard day", you would need a charger with about 4 Watts of power.
Well, running around with a backpack on any not-standard day will be a different story. I found this solar generator which can be a good example - it charges four AA-batteries (charging only two isn´t easily done, I suspect) and seems more or less mountable on a backpack. In the german description they claim to load the four included NiMH-AA-batteries with 2300 mAh in four hours with good sun emission.
I suspect, that it will be easily possible to load two AA-batteries with everything more than 6-7 Watts on sunny days, as long as the solar cells are not in the shade all the time. That they don´t have the right inclination and orientation isn´t perfect, of course, but shouldn´t be a big problem. More critically is shade, from trees, rocks or your head/hat. If your head casts shadow on the solar cell, you could possibly get some problems on days where you mainly go south.
For cloudy days it´s even less possible to make any predicition. There are too many unknowns, for example how thick the clouds are, if it´s overcast all day or just some showers coming through - the latter won´t affect your energy harvest to much.
Also, you have to ask yourself if you need to load them completely everyday. You can use the charger everyday and just prevent them from getting empty, becaue you always will load them at least a little.
You can improve your energy yield by using every short break to orientate and inclinate the panel so that the rays are hitting vertically. You could load your 2 AA batteries with an 8 W charger and 1 hour around noon at perfect orientation and weather. Doing so in the morning before leaving and in evening after arriving can also make a nice contribution.
Please note that these are theoretical considerations made using research for roof-top panels and to the best of my knowledge. Especially the effect of carrying it around can alter your results widely, so in this point you will have to collect some experiences. Please feel free to share them!
TL;DR: Buy a charger with at least 6, better 8 Watts. Then you probably will, if you pay a little attention to not casting too much shade on it, even on cloudy days be able to refill some of the battery´s capacity and to fill them completely on sunny days. Make sure your charger is able to charge the kind of energy storage you want to use, many of them don´t use AA batteries!
Sorry for the complicated style, I am sometimes struggling with my english.