Skip to content

Instantly share code, notes, and snippets.

@ahomu
Created April 14, 2013 03:07
Show Gist options
  • Save ahomu/5381242 to your computer and use it in GitHub Desktop.
Save ahomu/5381242 to your computer and use it in GitHub Desktop.
class ArticleActivity extends Activity with TypedActivity {
override def onCreate(savedInstanceState: Bundle) {
super.onCreate(savedInstanceState)
val details: EntryFragment = new EntryFragment()
details.setArguments(getIntent().getExtras())
getFragmentManager().beginTransaction().add(android.R.id.content, details).commit()
}
}
class EntryFragment extends Fragment {
override def onCreateView(inflater: LayoutInflater, container: ViewGroup, savedInstanceState: Bundle): View = {
if (container == null) {
return null
}
val v: View = inflater.inflate(R.layout.article, container, false)
val w: WebView = v.findViewById(R.id.browser).asInstanceOf[WebView]
w.loadUrl(getArguments().getString("url"))
return v
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment