Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.76 KB | None | 0 0
  1. package adammia.example.com.mdquiz;
  2.  
  3. import android.content.Intent;
  4. import android.net.Uri;
  5. import android.os.Bundle;
  6. import android.support.v7.app.AppCompatActivity;
  7. import android.view.Menu;
  8. import android.view.MenuInflater;
  9. import android.view.MenuItem;
  10. import android.view.View;
  11. import android.webkit.WebView;
  12.  
  13. import static java.lang.Boolean.FALSE;
  14.  
  15. /**
  16. * Created by adammia on 2017. 03. 21..
  17. */
  18.  
  19. public class MainActivity extends AppCompatActivity {
  20.  
  21.  
  22. @Override
  23. protected void onCreate(Bundle savedInstanceState) {
  24. super.onCreate(savedInstanceState);
  25. setContentView(R.layout.activity_main);
  26.  
  27. getSupportActionBar().setDisplayShowHomeEnabled(true);
  28. getSupportActionBar().setLogo(R.drawable.ic_launcher);
  29. getSupportActionBar().setDisplayUseLogoEnabled(true);
  30.  
  31. //**Insert the intro text into WebView
  32. WebView webview = (WebView) findViewById(R.id.webview_intro1);
  33. String intro = "<p align='justify'>" + getString(R.string.intro1) + "</p>";
  34. webview.setVerticalScrollBarEnabled(FALSE);
  35. webview.loadData(intro, "text/html", null);
  36.  
  37. webview = (WebView) findViewById(R.id.webview_intro2);
  38. String intro1 = "<p align='justify'>" + getString(R.string.intro2) + "</p>";
  39. webview.setVerticalScrollBarEnabled(FALSE);
  40. webview.loadData(intro1, "text/html", null);
  41.  
  42.  
  43. }
  44.  
  45. @Override
  46. public boolean onCreateOptionsMenu(Menu menu) {
  47. // Inflate the menu; this adds items to the action bar if it is present.
  48. MenuInflater mMenuInflater = getMenuInflater();
  49. getMenuInflater().inflate(R.menu.menu_main, menu);
  50. return true;
  51. }
  52.  
  53. @Override
  54. public boolean onOptionsItemSelected(MenuItem item) {
  55. // Handle action bar item clicks here. The action bar will
  56. // automatically handle clicks on the Home/Up button, so long
  57. // as you specify a parent activity in AndroidManifest.xml.
  58. if (item.getItemId() == R.id.material_io) {
  59. Uri webpage = Uri.parse(getResources().getString(R.string.material_io_link));
  60. Intent intent = new Intent(Intent.ACTION_VIEW, webpage);
  61. if (intent.resolveActivity(getPackageManager()) != null)
  62. startActivity(intent);
  63. }
  64. if (item.getItemId() == R.id.md_assets) {
  65. Uri webpage = Uri.parse(getResources().getString(R.string.material_tools_link));
  66. Intent intent = new Intent(Intent.ACTION_VIEW, webpage);
  67. if (intent.resolveActivity(getPackageManager()) != null)
  68. startActivity(intent);
  69. }
  70. return super.onOptionsItemSelected(item);
  71. }
  72.  
  73.  
  74. public void clickedButtonStart(View view) {
  75. Intent intent = new Intent(MainActivity.this, QuizActivity.class);
  76. startActivity(intent);
  77. }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement