content: package com.ajts.androidmads.sqlite2xlDemo;
  
  import android.Manifest;
  import android.content.Intent;
  import android.content.pm.PackageManager;
  import android.net.Uri;
  import android.os.Build;
  import android.os.Bundle;
  import android.support.v4.app.ActivityCompat;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          findViewById(R.id.btnSQL2XL).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
                      if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
                              == PackageManager.PERMISSION_GRANTED)
                          startActivity(new Intent(getApplicationContext(), SQLite2ExcelActivity.class));
                      else
                          ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
                  else
                      startActivity(new Intent(getApplicationContext(), SQLite2ExcelActivity.class));
              }
          });
  
          findViewById(R.id.btnXL2SQL).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
                      if (ActivityCompat.checkSelfPermission(MainActivity.this, Manifest.permission.WRITE_EXTERNAL_STORAGE)
                              == PackageManager.PERMISSION_GRANTED)
                          startActivity(new Intent(getApplicationContext(), Excel2SQLiteActivity.class));
                      else
                          ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);
                  else
                      startActivity(new Intent(getApplicationContext(), Excel2SQLiteActivity.class));
  
              }
          });
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.menu_main, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if(item.getItemId()==R.id.github){
              String url = "https://github.com/androidmads/SQLite2XL/";
              Intent i = new Intent(Intent.ACTION_VIEW);
              i.setData(Uri.parse(url));
              startActivity(i);
          }
          return true;
      }
  }
  