Back to project page playground-android-video.
The source code is released under:
This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a co...
If you think the Android project playground-android-video listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package v.app; /*from w w w .j a va2 s . com*/ import android.content.pm.PackageManager; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import v.app.Fragments.NoVideoFragment; import v.app.Fragments.VideoFragment; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); PackageManager packageManager = getPackageManager(); boolean hasCamera = packageManager.hasSystemFeature(packageManager.FEATURE_CAMERA_ANY); if (savedInstanceState == null) { if(hasCamera) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new VideoFragment()) .commit(); } else { getSupportFragmentManager().beginTransaction() .add(R.id.container, new NoVideoFragment()) .commit(); } } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }