1. Mycophagous drosophilids in Hokkaido, northern Japan, differ in fungal host selection from each other. Differences in life-history traits among them are explained by 'habitat' characteristics influential to the demography of adults and larvae. 2. Pleurotus fungi, to which three Hirtodrosophila species are specialized, produce fruiting bodies, usually in large clumps, intermittently throughout the fly breeding season on the large, dead logs or stumps of elms. On the other hand, the appearance of fruiting bodies is temporally unpredictable in fungi other than Pleurotus, being restricted, respectively, to particular seasons and influenced greatly by weather conditions. Newly emerging adults of polyphagous species have higher abilities to withstand starvation than those of the stenophagous Hirtodrosophila species, in order to cope with their temporally unpredictable habitats. However, habitat unpredictability for mature adults that have already found a fungal patch and fed and/or bred on it is reversed between the stenophagous and polyphagous species. The three Hirtodrosophila species specialized to Pleurotus fungi show significantly higher ratios of reproductive allocation than the other polyphagous species. There will be no chance for mature adult flies of the Hirtodrosophila species to find another breeding site. They are, therefore, regarded as living in spatially unpredictable habitats and to allocate more energy to current reproduction. On the other hand, mature adults of polyphagous species are expected to find another site more easily owing to their polyphagous nature, and invest some energy for residual reproductive value. 3. Five species preferring decayed fungi allocate nearly equal proportions of energy to reproduction, but partition is differently allocated to either large clutches or to large eggs. This differentiation of strategies is related to the difference in larval habitats. Larval habitats are regarded as more unstable for species utilizing fungi of shorter duration. In short-lasting habitats, larvae growing up within a short period would be favoured by natural selection. Larval developmental time is negatively correlated with relative egg size. Drosophila brachynephros and D. curvispina, which are somewhat specialized to soft, deliquescent Coprinus fungi, take the large-egg strategy to cope with their short-lasting larval habitats. On the other hand, H. histrioides, frequently using Polyporellus fungi with large, long-lasting fruiting bodies, take the opposite strategy, producing many small eggs. The same positive correlation between the developmental time and the duration of fungi preferred is also seen among species breeding on fresh fungi. However, the developmental time is always shorter in species preferring decayed fungi than in species preferring fresh ones if the relative egg size is the same. 4. The positive correlation between larval developmental time and adult survival, which is the basis for Sevenster & van Alphen's hypothesis that the difference in life histories promotes the co-existence of competing species in temporally variable environments, is tested for mycophagous drosophilids. It is demonstrated that there is a negative rather than positive correlation between larval developmental time and adult survival time under starvation. Adult starvation resistance is directly correlated with adult body size, and larval developmental time with relative egg size. This study suggests that the relations between larval developmental time and adult survival can be reversed according to the combinations of adult and larval habitats.