This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // assigning an onclick listener to a button | |
| // declare a Button b1 above outside the onCreate | |
| // assigns a button with id 'btn1' in the xml layout file to the variable b1 | |
| b1=findViewById(R.id.btn1); | |
| // assigning an onClickListener to the Button b1 | |
| b1.setOnClickListener(new View.OnClickListener() { | |
| @Override |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.widget.ArrayAdapter; | |
| import android.widget.TextView; | |
| import java.util.ArrayList; | |
| public class adapter_name extends ArrayAdapter<class_name> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //source: | |
| //https://www.concretepage.com/android/android-alarm-clock-tutorial-to-schedule-and-cancel-alarmmanager-pendingintent-and-wakefulbroadcastreceiver-example | |
| // permissions - add this in the manifest file | |
| // <uses-permission android:name="android.permission.WAKE_LOCK"/> | |
| //<receiver android:name=".AlarmReceiver"/> - add this to the manifest file | |
| alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); | |
| Intent myIntent = new Intent(MainActivity.this, AlarmReceiver.class); | |
| pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0, myIntent, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| lex programs repo - https://github.com/VandanaBaidya/Lex-Programs | |
| https://github.com/3ZadeSSG/Lex-Yacc-Basics/blob/master/Problem%20Statements%20Scanned%20Copy.pdf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Setting up a callback interface when querying the DB: | |
| https://stackoverflow.com/questions/42121771/handle-data-returned-by-an-async-task-firebase?rq=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //https://stackoverflow.com/a/39100135/10664312 | |
| int bs_upper_bound(int a[], int n, int x) { | |
| int l = 0; | |
| int h = n; // Not n - 1 | |
| while (l < h) { | |
| int mid = (l + h) / 2; | |
| if (x >= a[mid]) { | |
| l = mid + 1; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <TableLayout | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent"> | |
| <TableRow | |
| android:padding="20dp" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content"> | |
| <TextView | |
| android:text="hellp" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Contact { | |
| String name; | |
| String message; | |
| String dpUrl; | |
| String time; | |
| public Contact(String name, String message, String dpUrl, String time) { | |
| this.name = name; | |
| this.message = message; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void BSNL(String phoneNo,Callback cb) { | |
| OkHttpClient okHttpClient = new OkHttpClient(); | |
| String url="https://portal2.bsnl.in/myportal/validatemobile.do"; | |
| String referer_url = "https://portal2.bsnl.in/myportal/authorize.do"; | |
| MediaType parse = MediaType.parse("application/x-www-form-urlencoded"); | |
| okHttpClient.newCall(new Request.Builder().url(url) | |
| .post(RequestBody.create(parse,"mobile=" + phoneNo)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| implementation 'com.google.firebase:firebase-auth:19.0.0' | |
| implementation 'com.google.android.gms:play-services-auth:17.0.0' | |
| public void initGoogleSignIn() { | |
| mAuth = FirebaseAuth.getInstance(); | |
| GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).requestIdToken(getString(R.string.default_web_client_id)).requestEmail().build(); | |
| GoogleSignInClient mGoogleSignInClient = GoogleSignIn.getClient(fb.this, gso); | |
| Intent signInIntent = mGoogleSignInClient.getSignInIntent(); | |
| startActivityForResult(signInIntent, 111); |
OlderNewer