Posts

How to make a basic Hello World app in Android Studio

Image
 It's very easy to create your own first app using Android Studio Just follow a few steps to get YOUR VERY OWN  Android App built with Android Studio. Step 1: Create a new project in Android Studio Step 2: Click the run > button in green in Android Studio Step 3: Android Studio will open your app in a Emulator, you should see "Hello World" text. For more information, watch the video given below.

How to set a Subtitle on ActionBar in Sketchware

Image
Open OnCreate event Now insert this code( View on Github ): getActionBar ( ) . setSubtitle ( "BYE" ) ; Alternatively, you can use( View on Github ): getSupportActionBar ( ) . setSubtitle ( "BYE" ) ; Done. You will now see Subtitle.

How to detect battery charging mode

Image
Steps to detect battery charging mode in Sketchware First of all, create a button in your Sketchware Project. Now paste the following code in button onClick( View on Github ): IntentFilter ifilter = new IntentFilter ( Intent . ACTION_BATTERY_CHANGED ); Intent batteryStatus = registerReceiver ( null , ifilter ); int chargePlug = batteryStatus . getIntExtra ( BatteryManager . EXTRA_PLUGGED ,- 1 ); boolean usbCharge = chargePlug == BatteryManager . BATTERY_PLUGGED_USB ; boolean acCharge = chargePlug == BatteryManager . BATTERY_PLUGGED_AC ; if ( usbCharge ){ /*BATTERY CHARGING THROUGH USB*/ Toast . makeText ( getApplicationContext (), "Device charging through USB" , Toast . LENGTH_LONG ). show (); } else if ( acCharge ) { /*BATTERY CHARGING THROUGH AC*/ Toast . makeText ( getApplicationContext (), "Device charging through AC" , Toast . LENGTH_LONG ). show (); } else { /*DEVICE NOT CHARGING*/ Toast . makeText ( getApplicationC

If our data is deleted from Firebase then how can we restore data from Firebase to our app.

Read the below point to know how can we restore Firebase deleted data.   If you are a blaze plan user, you have the option to set up automated backups for your database. However, seeing that you are asking this question I doubt that you have those available: AFAIK, there is no way of restoring deleted data apart from restoring a backup since the related data has been removed from the database. There are great concepts and options for database backups as well as database auditing / versioning out there, I recommend looking into that to prevent further incidents. As you pointed out, you did specify 'not the whole database'. However, you could download the backup and extract the specific data yourself, manually adding it back to the database. The backups are stored on a google cloud storage bucket in an easily readable JSON format. Thanks! Note: This was originally written at  Stackoverflow ,you can view this Page anytime.

How to make a URL shortener in Sketchware. (Firebase Dynamic Links)

Image
 See image below main.xml The below image in on Shrink clicked Requirements 1. A String variable "json" 2. A String variable "url_to_short 3. A map variable "map" The code in string json "join {"longDynamincLink": "https:// messagesin.ga /?link= Here in place of "messagesin.ga" write your dynamic link. Ex-myapp.page.link  Insert a join block again in "and" section In next join block for the condition "join" add url_to_short string block. In the "and" condition add below code. ", "suffix": { "option": "SHORT"     } } And a toast block with message "Please wait." RequestNetwork set params "map" to request type "REQUEST BODY" RequestNetwork start network to method "POST" to url https://firebasedynamiclinks.googleapis .com/v1/shortLinks?key= YOUR_WEB_API_KEY Here in place of YOUR_WEB_API_KEY add your project's API key. In textvi

How to Block screenshot in Sketchware

Image
 To block Screenshot or screen recording use code below in onCreate or event after which you want to block Screenshot. getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE; View on Github For detailed instructions, Watch video given below.

How to make edittext in dialog in Sketchware

Image
To add a edittext in Sketchware, follow the steps given below. 1. Add a dialog with ID dialog. 2. Add button, title,message in dialog. 3. Under the title section(if dialog only haves title) add the code below with add source directly block. final EditText myedittext = new EditText (Activitynamehere.this); dialog.setView(myedittext); View on Github Now in place of Activitynamehere add the Activity name.  To use this, paste the code in when button OK clicked. Please use code below👇 mytext = myedittext.getText().to String(); View on Github Now add everything what will happen next. Done! Save and run the project. Didn't understand? Watch video below.

Difference between Invisible and Gone in Sketchware

Image
1. Invisible If you set anything as Invisible  in Sketchware, it will hide but still take up space 2. Gone If you set anything Gone , it will hide and don't take up space too Hope you found this helpful!

Using Firebase database for getting data from user in Sketchware

Image
1. Setup Firebase 2. Add a edittext,a button, a firebase Db component Db, a map variable map. 3. In button onClick event, add blocks as shown below 4. Save and run the project the data will be added in you Firebase Database.

Display YouTube videos on Sketchware App

Image
1. Copy the code below( View on Github ) data:text/html, <iframe width="100%" height="100%" src="http://www.youtube.com/embed/3DSrJos_Ick" frameborder="0"></iframe> 2. In place of  3DSrJos_Ick  add the id of YouTube video. 3. To get video id go to youtube and copy video url Example:https://youtu.be/ 3DSrJos_Ick You can see the dark part of video url is video id. 4. Add a webview and change its width to match parent and hieght to 325. 5. Add a block webview loadurl block in onCreate and choose a webview then paste the code in loadurl 6. Save and run the project.

Popular posts from this blog

How to make edittext in dialog in Sketchware

How to use request network for webview in Sketchware