Advertisement
Guest User

Teil der MainActivity

a guest
Nov 14th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.46 KB | None | 0 0
  1.  
  2. public class MainActivity extends AppCompatActivity {
  3.  
  4.     private AppBarConfiguration mAppBarConfiguration;
  5.  
  6.     private final static int REQUEST_ENABLE_BT = 1;
  7.     BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
  8.     private ConnectionViewModel connectionViewModel;
  9.     private BluetoothAdapter adapter = null;
  10.     private BluetoothSocket socket = null;
  11.     private static String mac_adresse = "98:D3:31:FC:34:19";
  12.     private UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
  13.     public boolean is_connected = false;
  14.     private static final String LOG_TAG = "";
  15.     private OutputStream stream_out = null;
  16.     private InputStream stream_in = null;
  17.     Switch s;
  18.     TextView t;
  19.     TextView t2;
  20.     Button b;
  21.     double value;
  22.  
  23.  
  24.     @Override
  25.     protected void onCreate(Bundle savedInstanceState) {
  26.         super.onCreate(savedInstanceState);
  27.         setContentView(R.layout.activity_main);
  28.         connectionViewModel =
  29.                 ViewModelProviders.of(this).get(ConnectionViewModel.class);
  30.  
  31.         Toolbar toolbar = findViewById(R.id.toolbar);
  32.         setSupportActionBar(toolbar);
  33.         //controls the switching between the fragments with the
  34.         //navigation view
  35.         DrawerLayout drawer = findViewById(R.id.drawer_layout);
  36.         NavigationView navigationView = findViewById(R.id.nav_view);
  37.         // Passing each menu ID as a set of Ids because each
  38.         // menu should be considered as top level destinations.
  39.         mAppBarConfiguration = new AppBarConfiguration.Builder(
  40.                 R.id.nav_home, R.id.nav_history, R.id.nav_map,
  41.                 R.id.nav_settings, R.id.nav_share, R.id.nav_datagetting, R.id.nav_connection)
  42.                 .setDrawerLayout(drawer)
  43.                 .build();
  44.         NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
  45.         NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
  46.         NavigationUI.setupWithNavController(navigationView, navController);
  47.  
  48.         //transfer of the data from the connection fragment to history fragment//
  49.  
  50.  
  51.  
  52.  
  53.  
  54.         //////////////////////////////////////////////////////////////////////////
  55.         int MyVersion = Build.VERSION.SDK_INT;
  56.         if (MyVersion > Build.VERSION_CODES.LOLLIPOP_MR1) {
  57.             if (!checkIfAlreadyhavePermission()) {
  58.                 requestForSpecificPermission();
  59.             }
  60.         }
  61.  
  62.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement