Confirmed users
170
edits
m (Add a ToC back in) |
m (Java.) |
||
| Line 67: | Line 67: | ||
Inside a layout <code>.xml</code> file, add the following: | Inside a layout <code>.xml</code> file, add the following: | ||
<syntaxhighlight lang="XML"> | <syntaxhighlight lang="XML"> | ||
<org.mozilla. | <org.mozilla.geckoview.GeckoView | ||
android:id="@+id/geckoview" | android:id="@+id/geckoview" | ||
android:layout_width="fill_parent" | android:layout_width="fill_parent" | ||
| Line 74: | Line 74: | ||
=== Initialize GeckoView in an Activity === | === Initialize GeckoView in an Activity === | ||
'''1. Import the GeckoView classes inside an Activity:''' | '''1. Import the GeckoView classes inside an Activity:''' | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="Java"> | ||
import org.mozilla.geckoview.GeckoRuntime | import org.mozilla.geckoview.GeckoRuntime; | ||
import org.mozilla.geckoview.GeckoSession | import org.mozilla.geckoview.GeckoSession; | ||
import org.mozilla.geckoview.GeckoView | import org.mozilla.geckoview.GeckoView; | ||
</syntaxhighlight> | </syntaxhighlight> | ||
'''2. In that activity's <code>onCreate</code> function, add the following:''' | '''2. In that activity's <code>onCreate</code> function, add the following:''' | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="Java"> | ||
GeckoView view = findViewById(R.id.geckoview); | |||
GeckoSession session = new GeckoSession(); | |||
GeckoRuntime runtime = GeckoRuntime.create(this); | |||
session.open(runtime) | session.open(runtime); | ||
view.session | view.setSession(session); | ||
session.loadUri(" | session.loadUri("about:mozilla"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||