0

So there is an activity containing a webview. On launch/click on App Icon it should launch activity with webview as dialog on the HomeScreen of the device. Is there a way to achieve this?

  • You can use dialog theme to make your Activity look like a dialog. I'm unsure if it would work like that on top of the home screen though, or if you'd end up with a dialog on top of a blank screen. You'd need to test it and find out. See https://stackoverflow.com/questions/1979369/android-activity-as-a-dialog – Gabe Sechan Nov 10 '21 at 07:10
  • Thanks for your response. I also want to know how can I launch this activity on homescreen. @GabeSechan – Gauri Chaudhary Nov 10 '21 at 07:21
  • Make it a launcher activity. An app can actually have more than 1 if needed. But the user will have to create the shortcut on the home screen, there is no way to force that (although many home screen apps will do so by default when an app is installed). – Gabe Sechan Nov 10 '21 at 07:56

1 Answers1

-1

Yes, you can do it. Set the theme of MainActivity to Dialog, then you'll achieve it.

  <activity android:name=".MainActivity"
      android:theme="@style/Theme.AppCompat.Dialog">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>

It works fine for me. Hope it can help you~

Sarah
  • 72
  • 3