Articles

Comment créer une application qui convertit un texte en parole

 Cette section donne le code de la vidéo dans laquelle j'ai montré comment créer une application qui convertit un texte en parole très facilement avec sketchware. Le seul code utilisé pour créer cette application est le suivant : 👉 final android.speech.tts.TextToSpeech t1 = new android.speech.tts.TextToSpeech(getApplicationContext(), new android.speech.tts.TextToSpeech.OnInitListener() { @Override public void onInit(int status) {     if(status == android.speech.tts.TextToSpeech.ERROR) { Toast.makeText(getApplicationContext(), "Error",Toast.LENGTH_SHORT).show(); } } }); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View _v) { String sentence = edittext1.getText().toString(); Toast.makeText(getApplicationContext(), sentence,Toast.LENGTH_SHORT).show(); t1.speak(sentence,android.speech.tts.TextToSpeech.QUEUE_FLUSH, null); } } ); On peut le mettre dans "onCreate" comme dans "onclick". Il faut être sûr que les...

Comment convertir la parole en texte

Dans cette section vous avez les codes pour la vidéo sur comment créer une application qui convertit une parole en texte avec sketchware. Pour cela il faut ajouter un bouton "button1", un edittext "edittext1", un moreblock "extra" et un filepicker "file" puis on utilise les codes suivants comme suite:  Pour onButtonClick :   👉 Intent intent = new Intent(android.speech.RecognizerIntent.ACTION_RECOGNIZE_SPEECH); intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE_MODEL, android.speech.RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(android.speech.RecognizerIntent.EXTRA_LANGUAGE, Locale.getDefault()); intent.putExtra(android.speech.RecognizerIntent.EXTRA_PROMPT, "Speak Now"); try { startActivityForResult(intent, REQ_CODE_SPEECH_INPUT); } catch (ActivityNotFoundException a) { Toast.makeText(getApplicationContext(), "There was an error", Toast.LENGTH_SHORT).show(); }   Pour moreblock :   👉 } public static f...

Afficher le pourcentage de la batterie dans votre application

Le code de la vidéo sur comment afficher le pourcentage de la batterie dans votre application est le suivant :   👉 BatteryManager bm = (BatteryManager)getSystemService(BATTERY_SERVICE); int batLevel = bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CAPACITY); textview1.setText(Integer.toString(batLevel));   Vous allez le mettre dans onCreate et Id de votre textview à "textview1"

Comment créer une application d'envoi de messages SMS

le code pour créer une application d'envoi de messages SMS est le suivant : onimage clicked : 👉 Uri uri = Uri.parse("smsto:"+Numero); Intent sms = new Intent(Intent.ACTION_SENDTO, uri); sms.putExtra("sms_body", Msg); startActivity(sms); les noms des variables sont respectivement pour le numéro "Numero" et pour message "Msg" la vidéo sur youtube : regarder la vidéo ici

Comment créer une lampe torche avec sketchware

 Les code relatifs à la vidéo youtube sur comment créer une application lampe torche dans sketchware sont les suivants : onCreate :  👉 avoir_lampe = getPackageManager(). hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); allumer : 👉 android.hardware.camera2.CameraManager cameraManager = (android.hardware.camera2.CameraManager) getSystemService(Context.CAMERA_SERVICE); try { String cameraId = cameraManager.getCameraIdList()[0]; cameraManager.setTorchMode(cameraId, true); status = true; imageview1.setImageResource(R.drawable.ic_adb_black); } catch (android.hardware.camera2.CameraAccessException e) { } etreindre : 👉 android.hardware.camera2.CameraManager cameraManager = (android.hardware.camera2.CameraManager) getSystemService(Context.CAMERA_SERVICE); try { String cameraId = cameraManager.getCameraIdList()[0]; cameraManager.setTorchMode(cameraId, false); status = false; imageview1.setImageResource(R.drawable.ic_adb_black); } catch (android.hardware.camera2.CameraAccessExc...