Posts

Code Blocks

Intent for opening inbuilt music player  Intent intent = new Intent();   intent.setAction(android.content.Intent.ACTION_VIEW);   intent.setDataAndType( Uri .parse(YOUR_SONG_PATH), "audio/*" );  startActivity(intent); Intent for open app Context ctx= this ; // or you can replace **'this'** with your **ActivityName.this** try { Intent i = ctx.getPackageManager().getLaunchIntentForPackage( "com.twidroid.SendTweet" ); ctx.startActivity(i); } catch (NameNotFoundException e) { // TODO Auto-generated catch block }

Elon Musk

 https://www.youtube.com/watch?v=GVum_R9DQ3I https://www.youtube.com/watch?v=OlP9623gfN0&ab_channel=ProvokeTributes

IMP

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Sort { public Sort(String sentence)  { String questions = "(what |when |why |which |who |how |whose |whom |where )"; String helpingVerbs = "(is |am |are |was |were |being |been |be |have |has |had |do |does |did |will |would |shall |should |may |might |must |can |could )"; String normalPersons = "(i |me |my |mine |he |she |it |his |her |its |we |us |our |ours |they |them |their |theirs)"; String devicePersons = "(you |your |yours)"; String unknown = "((([a-zA-Z\\s]+)?+)?|([a-zA-Z\\s]+)?)?"; String regexToSearch = unknown + questions + helpingVerbs + normalPersons+ unknown; String regexToMe = unknown + questions + helpingVerbs + devicePersons+ unknown; Pattern checkRegex = Pattern.compile(regexToSearch); Matcher regexMatcher = checkRegex.matcher(sentence); if(sentence.matches(regexToSearch))  { System.out.prin...

APP

 Reciever BackGroundListening.java package com.assist ; import android.content.BroadcastReceiver ; import android.content.Context ; import android.content.Intent ; import android.os.Bundle ; import android.speech.RecognitionListener ; import android.speech.RecognizerIntent ; import android.speech.SpeechRecognizer ; import android.speech.tts.TextToSpeech ; import android.util.Log ; import java.util.ArrayList ; import java.util.Locale ; public class BackGroundListening extends BroadcastReceiver{ private static final int REQUEST_CODE_SPEECH_INPUT = 1000 ; private TextToSpeech mTextToSpeech ; SpeechRecognizer mSpeechRecognizer ; Intent mSpeechRecognizerIntent ; String FinalRecognizedText ; @Override public void onReceive (Context context , Intent intent2) { mSpeechRecognizer = SpeechRecognizer. createSpeechRecognizer (context) ; mTextToSpeech = new TextToSpeech(context , new TextToSpeech.OnInitListener() { @Override pu...

face detection

dependencies {     // Java language implementation     implementation "androidx.biometric:biometric:1.0.1" private Executor executor ; private BiometricPrompt biometricPrompt ; private BiometricPrompt . PromptInfo promptInfo ; @Override protected void onCreate ( Bundle savedInstanceState ) {     super . onCreate ( savedInstanceState );     setContentView ( R . layout . activity_login );     executor = ContextCompat . getMainExecutor ( this );     biometricPrompt = new BiometricPrompt ( MainActivity . this ,             executor , new BiometricPrompt . AuthenticationCallback () {         @Override         public void onAuthenticationError ( int errorCode ,                 @NonNull CharSequence errString ) {             super . onAuthenticationError ( errorCode , errStr...