Skip to main content

Posts

Showing posts from April, 2018

Restrict the length of Edittext characters

Restrict the length of Edittext characters 


1) Open yoursketchware project.Add edittext. In the logic section, OnActivityCreate 


Add the following code

InputFilter[] editFilters = edittext1.getFilters();InputFilter[] newFilters =newInputFilter[editFilters.length +1];System.arraycopy(editFilters,0, newFilters,0

Add Admob Interstitial Ads To Your Sketchware Project Using AIDE

Add Admob Interstitial Ads To Your Sketchware Project Using AIDE







1) Export your Project from Sketchware. The project will be in the format of zip file.Extract it.Check whether any files are missing.In my case the build.gradle file was missing.So I copied the build.gradle file of my previous project and pasted it . Note : After pasting , change the application id in the build.gradle file to the package name of the project in which you want to add Ads














Skip the Above steps if your project file contains build.gradle


2) Open the project in AIDE . Navigate to build.gradle which is in the app directory
Add the following code 
compile 'com.google.android.gms:play-services-ads:+'




3)Navigate to AndroidManifest.xml and add the following Code


<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />




Also add the activity
<activity android:name="com.google.android.gms.ads.AdA…

Implement Custom Toast In Your App Using Sketchware

Implement Custom Toast In Your App Using Sketchware


In this tutorial I will show you how to implement custom toast.Its very easy and simple. Follow the steps ....


1)Create a  new project in Sketchware. Add a Button
Screenshot is given Below






2)Add a New Custom View.In the custom view add a Linear Layout. Inside the LinearLayout add a Textview.
Screenshot is Given Below









3) Now go to the logic area. You will see two events. onCreate&Button:button1 onClick.






Click on Button:button1 onClick. In this event add an add source directly block.

Add the following code inside add source directly block






View layoutValue = LayoutInflater.from(MainActivity.this).inflate(R.layout.custom, null); TextView textview1 = (TextView) layoutValue.findViewById(R.id.textview1);
textview1.setText("Hello Everyone ");
                Toast toast = new Toast(getApplicationContext());                 toast.setDuration(Toast.LENGTH_SHORT);                 toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);           …

Did you like this tutorial ?