Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity extends AppCompatActivity {
- private AppBarConfiguration mAppBarConfiguration;
- private final static int REQUEST_ENABLE_BT = 1;
- BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
- private ConnectionViewModel connectionViewModel;
- private BluetoothAdapter adapter = null;
- private BluetoothSocket socket = null;
- private static String mac_adresse = "98:D3:31:FC:34:19";
- private UUID uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
- public boolean is_connected = false;
- private static final String LOG_TAG = "";
- private OutputStream stream_out = null;
- private InputStream stream_in = null;
- Switch s;
- TextView t;
- TextView t2;
- Button b;
- double value;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- connectionViewModel =
- ViewModelProviders.of(this).get(ConnectionViewModel.class);
- Toolbar toolbar = findViewById(R.id.toolbar);
- setSupportActionBar(toolbar);
- //controls the switching between the fragments with the
- //navigation view
- DrawerLayout drawer = findViewById(R.id.drawer_layout);
- NavigationView navigationView = findViewById(R.id.nav_view);
- // Passing each menu ID as a set of Ids because each
- // menu should be considered as top level destinations.
- mAppBarConfiguration = new AppBarConfiguration.Builder(
- R.id.nav_home, R.id.nav_history, R.id.nav_map,
- R.id.nav_settings, R.id.nav_share, R.id.nav_datagetting, R.id.nav_connection)
- .setDrawerLayout(drawer)
- .build();
- NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
- NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
- NavigationUI.setupWithNavController(navigationView, navController);
- //transfer of the data from the connection fragment to history fragment//
- //////////////////////////////////////////////////////////////////////////
- int MyVersion = Build.VERSION.SDK_INT;
- if (MyVersion > Build.VERSION_CODES.LOLLIPOP_MR1) {
- if (!checkIfAlreadyhavePermission()) {
- requestForSpecificPermission();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement