Berkeley's argument begins from a strict form of empiricism: everything we know about physical objects, their color, shape, weight, and texture, comes to us as ideas in perception, and we have no independent access to a matter supposedly lying behind those ideas. If matter cannot even be coherently described except in terms of how it is perceived, he argued, then positing an unperceived material substratum adds nothing and explains nothing; better to say plainly that to exist, for a physical thing, just is to be perceived, with God's constant perception keeping the world in being when no finite mind is looking at it.
Hegel's idealism, developed a century later in Germany, is a different animal: rather than denying an external world, he argued that reality as a whole is the self-development of Spirit, or Geist, an underlying mental process that comes to know itself through nature, human history, art, religion, and philosophy, with each stage of thought giving rise to its own contradiction and a higher synthesis. Both versions share the core commitment that mind is not a late add-on to a pre-existing material universe but is, in some sense, prior to or constitutive of the physical world as we encounter it. Samuel Johnson's famous reply to Berkeley, kicking a stone and declaring that he refuted it thus, remains the most quoted, and least philosophically decisive, objection either version has faced.