Skip to content

Instantly share code, notes, and snippets.

View jobinjj's full-sized avatar

jobin jobinjj

View GitHub Profile
....
public class MainActivity extends AppCompatActivity {
private Button btnSimpleToast,btnPositionedToast,btnCustomToast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
....
....
public class MainActivity extends AppCompatActivity {
private Button btnSimpleToast,btnPositionedToast,btnCustomToast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSimpleToast = findViewById(R.id.btn_simple_toast);
public class MainActivity extends AppCompatActivity {
private Button btnSimpleToast,btnPositionedToast,btnCustomToast;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnSimpleToast = findViewById(R.id.btn_simple_toast);
btnPositionedToast = findViewById(R.id.btn_positioned_toast);
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:id="@+id/container"
android:layout_height="wrap_content"
android:background="@color/colorAccent">
<TextView
android:id="@+id/textView"
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/btn_simple_toast"
public class Main2Activity extends AppCompatActivity {
private SettingsClient mSettingsClient;
public static final int REQUEST_LOCATION_PERMISSION = 100;
public static final long UPDATE_INTERVAL_IN_MILLISECONDS = 10000;
public static final long FASTEST_UPDATE_INTERVAL_IN_MILLISECONDS = 5000;
public static final int REQUEST_CHECK_SETTINGS = 100;
private LocationSettingsRequest mLocationSettingsRequest;
public FusedLocationProviderClient mFusedLocationClient;
public LocationRequest mLocationRequest;
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
implementation 'com.google.android.gms:play-services-location:16.0.0'
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;
import androidx.viewpager.widget.ViewPager;
import android.os.Bundle;