Skip to main content

Posts

Android ViewPager Fragment Example | Implement Unlimited Fragments

In Android anyone can create fragments that are views on an activity with different behavior which can be used to build a multi-pane User interface. In this blog you'll see Android ViewPager Fragment Example in which we will create fragments on activity.

However, the best part about fragments are that they can be reused in multiple activities.

Android ViewPager Fragment Example Here is a step by step tutorial on Android ViewPager Fragment Example:

Open Android Studio and create a new Project. Create an Empty Blank Activity in the project.Wait for Gradle to build and then go to Project in the Left Corner.Have Android Selected in the Project Drop down menu and go to your package name in the Java folder (app > java > 'com.cpmpanyname.appname')Right click on the folder and then go to New > Java ClassName this class as ViewPagerAdapter as keep visibility as public with no modifiers.Once the class is created open it and extend the class to FragmentPagerAdapter.Now click…
Recent posts

Get your Website Ranked on Google using this Search Console Android App

Getting your website ranked on Google Search is a dream of many bloggers and website owners. However, this can be quite overwhelming initially specially if you are some body like me who just started up with a new blog and have no idea about how to get your website ranked on Google.

Before starting up here we recommend you to go through this blog to set up required plugins in case you are using a WordPress CMS for your blog. 8 Best SEO Plugins for WordPress to Get Higher Rankings on Search Engines.


Getting back, to getting website ranked on Google, So once your website or blog is built you need to make it easier for Google bots to search and crawl your website. To make this happen either ou need to wait for few ages to make Google bots index your website or you can use a free tool called Search Console where you can submit and verify your website and get it quickly (utmost 3 days) crawled indexed by Google bots in Google Search.


However Search Console tool initially can seem to be qui…

Python Turtle Example: Flappy Bird Development in under 10 mins!

Python Turtle Example | Develop Flappy Bird Clone in 10 mins In the following tutorial, we have used following Python libraries:
1. random: To generate obstacles at random position. 2. turtle: To help provide directions to the player. 3. vector from freegames: To 2-dimensional vectors.
Before developing the game, here is a screenshot of what you'll be developing in 10 mins.
Steps to create Python Flappy Bird Game:
1. Open Pycharm and install 'freegames' package by going to Files > Settings > Project Interpreter. 2. Click on '+' sign on right and search for 'freegames' package. 3. Import packages in your project by writing following lines of code:
from random import * from turtle import * from freegames import vector 4. There are two variables required in the game, one for Bird object and another for an array of obstacles:
bird = vector(0, 0) balls = []
5. Create function for the player response on screen tap:
def tap(x, y): "Move bird up in res…

Android Close Application Programmatically Tutorial

While designing an app you may have a login screen and after the user logs in the app and is on the Main member activity, you may also want the app to exit after the user presses the back button and isn't directed towards the Login screen again.

Android Close Application Programmatically
To prevent your Android app user to be redirected towards the login screen again here is a simple Java code that you can use in Android Studio in the Member Activity Java file to close application programmatically:

@Overridepublic void onBackPressed() { Intent start = new Intent(Intent.ACTION_MAIN); start.addCategory(Intent.CATEGORY_HOME); start.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); start.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(start); }
The code shown above kills the activity and user is directed to Home Screen of his Android.

How to Make A Website An App on Android

In this blog you’ll learn How to Make A Website An App on Android. For this, you must have Android Studio installed on your PC or Mac.
How to Make A Website An App on Android We'll use our website https://www.faultinmycode.com. To make an Android App of your website follow the steps given below:

1.Open Android Studio and create an Android Project

2. Create Empty Activity.

3. Open activity_main (search in the Project Panel on the left) and enter XML code for WebView inside layout tags. Code for this is as follows:

activity_main.xml <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical&quo…

Top 5 best programming language for Mobile Apps

More than 3,000+ Android Apps are published everyday on Google Play store and the best thing about these apps are that they aren’t only developed by professionals but are also made by some armatures who are school kids, college students or some retired old man.

Its not only Android smartphones that have reached almost every hand on this planet but also it’s development that has become dream of almost every Android geek to have their app on the Play Store. But however before you begin your journey with Android, its important to have some basic knowledge about Programming.

To help you get started with your Android App Development here is a list of best programming language for Mobile Apps Development:

1. Java | Android App Development for Beginners Released back in 1995 by Sun Microsystems, Java is a key component in Android OS. The Android SDK uses the Java language as the basis for Android applications. It’s fairly easy to use Java programming language especially in Android Studio ID…

Handler with runnable in Android Example Tutorial | FaultInMyCode

In this blog about threading in Android, you’ll learn about how to set up a thread in android other than the main thread to continue a different process.

I do believe you’re on Facebook and have downloaded a video directly from the Facebook app itself which you can view in offline mode later. Have you noticed how while the video is downloading, you’re still able to look at your news feed or tag your friends on a status and etc. and when the video is downloaded a Toast message appears that video has been downloaded successfully, This is known as multithreading.

Multithreading is the ability of a central processing unit (CPU) or a single core in a multi-core processor to execute multiple processes or threads.

To explain how threading works in even more detail and how you can thread your app too and make it multifunctional and smarter, in this tutorial we will build an Android app in which you’ll be clicking on a button to change a TextView that’ll change after 10 seconds and meanwhi…

Things to know about Android findViewByID before you start coding!

When you open Android studio and start building up your User Interface (UI) in activity_main.xml file and later code stuff in Java file, findViewByID is one most common method that you would’ve called in onCreate() method of MainActivity.Java File. In this blog, I’ll teach you everything that you should know about findViewByID and how to code it!
What is findViewByID? findViewByID is a commonly used method for Android App development in Android Studio programmed in Java or Kotlin Programming Language.

It’s an Android viewobject used to get a reference to the UI components specified in the XML layout file. So how does it references a variable in Java file to a component in the XML file?
The simple answer to this is the R file. R is an automatically generated file by Android Studio (even after you delete it, its automatically generated!).

findViewByID finds the ID of a particular component in the R file and then looks for the related view. It must be done in the onCreate method when t…

6 Android Development Tips for Beginners from Experienced Developers

If you’re someone looking ahead to spend your summer or winter break learning Android Development and planning to launch an app soon then here we have got some 6 top most Android Development tips from experienced developers to help you launch your app and make it a success.
Keep your IDE updated An Integrated Development Environment (IDE) is a software application that provides comprehensive facilities to computer programmers for App development. Android Studio or Eclipse whatever IDE you use for Android development, make sure to keep it updated to (stable) latest version. Develop for all Being a versatile OS, Android is available for many different screen sizes, so if you’re targeting mobile or tablet, make sure you develop it for all gadget screen sizes that fall under mobile or tablet category. Optimize for Speed Unlike desktops, many mobile gadgets don’t come with good processing speeds also RAM is limited. Limit Permissions Limit permissions required by your app, information lik…

Dealing with Jsonobject Java Tutorial with Example Explained

Dealing with Jsonobject Java language, if you've some data in JSON format and are trying to parse it in some readable format for the user using Java programming, then you're reading the right blog!

In this tutorial we will be using Android Studio in which using Java programming we will parse the JsonObject that we will receive from the server and text will be displayed in TextView.

Jsonobject Java Tutorial 
Here is the sample JSONObject data:


[
 {
   "name": "Afghanistan",
   "alpha": "AFG"
 },
 {
   "name": "Ă…land Islands",
   "alpha": "ALA"
 },
 {
   "name": "Albania",
   "alpha": "ALB"
 },
 {
   "name": "Algeria",
   "alpha": "DZA"
 },
 {
   "name": "American Samoa",
   "alpha": "ASM"
 },
 {
   "name": "Russian Federation",
   "alpha": "RUS"
 },
 {
   "name&q…

Using BeautifulSoup Python Example Web Scraping Stock prices from Bloomberg Website

In this tutorial on Python, we will use BeautifulSoup Python Example for web scraping current S&P 500 index prices available at Bloomberg website.
What is Web Scraping? As a developer, most of us work on various projects that require data for which we are dependent on some websites like in this tutorial where are would need latest Stock prices in the market and for this, we are going to be dependent on Bloomberg website.
Extracting information from some website is known as Web Scraping and doing web scraping is somewhat illegal. Why so? well by doing web scraping though you are leveraging other developers work and at the same time, you are also utilizing their server and that too without their consent. Developing an app for stock market prices that uses a web scraping and publishing that on App store can actually get you a lifetime ban.

But don’t worry as this is just a tutorial and it won’t stress their servers. But if you are planning to develop some app that would need to str…

Using Android SoundPool Build your Own Android Piano App

Playing any musical instrument on our Android device is the best thing that most of us like to do, be it Piano, Violin or Xylophone. Such apps basically use Android media library class known as Android SoundPool that handles short music tones on pressing of a button or object.

Android SoundPool In this given below tutorial we will teach you how to build your own Piano using Android SoundPool class. For this we expect you have prior knowledge about ConstraintLayout in Android, if not please check out our tutorial on how to make your calculator app in Android.
Things NeededWindows 7 or higher / Mac OS (Mavericks or higher) with minimum 4GB RAMAndroid Studio (with SDK and latest API) and JAVA installed on system.MP3 Piano Resource Files for each button. Link is here. What we will build So the app we will build in this tutorial will have around 14 buttons, each having assigned to an onClick() method that’ll play the audio using SoundPool class.
The buttons and their location will be set…