Hi Guys, Welcome to Proto Coders Point, In the Android Tutorial, we are implementing the GitHub android circular countdown timer library, TICKER by using which we can build an android studio countdown timer app.
Ticker Library countdowntimer android
Ticker a android library which can be used for different count down timer activities, and Progress Loaders.
DEMO
Let’s begin implementing count down timer in android.
Adding CountDown Timer android in your android Project
I assume that you already have created a new project in android studio(IDE).
Android Studio > Files > New > New Project > give a name to project
SetUp the ticker library
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
maven { url 'https://jitpack.io' } // add this line
}
}
You should add the Maven url in build.gradle( project level).
Add the dependency:
Then, add the ticker count down dependencies in build.gradle( module : app ).
dependencies {
implementation 'com.github.rehmanmuradali:ticker:1.0.0' // add this line
}
and then its done with adding library into the android project.
UI of Ticker Circular countdown timer view – XML android timer
Create a circularView object that point the UI of the View.
CircularView.OptionsBuilder builderWithTimer =
new CircularView.OptionsBuilder()
.shouldDisplayText(true)
.setCounterInSeconds(30)
.setCircularViewCallback(new CircularViewCallback() {
@Override
public void onTimerFinish() {
// Will be called if times up of countdown timer
Toast.makeText(MainActivity.this, "CircularCallback: Timer Finished ", Toast.LENGTH_SHORT).show();
}
@Override
public void onTimerCancelled() {
// Will be called if stopTimer is called
Toast.makeText(MainActivity.this, "CircularCallback: Timer Cancelled ", Toast.LENGTH_SHORT).show();
}
});
circularView.setOptions(builderWithTimer);
Create a builder for the circularView Timer
.shouldDisplayText(true) is used to Display a text inside the Ticker Circular View timer
.setCounterInSeconds(30) set the timer for 30 sec or more as per your requirement but it should be in seconds.
onTimerFinish() : This will get called when timer will get finished.
onTimerCancelled() : When user stops the timer.
How to start, stop, pause, resume the count down timer?
//start circular view to rotate
circularView.startTimer();
// pause circular view and timer
circularView.pauseTimer()
// resume circular view and timer
circularView.resumeTimer();
// stop circular view and timer
circularView.stopTimer();
Hi Guys, Welcome to ‘Proto Coders Point’ in this Post we will learn how to Create a Alert Dialog in Flutter app development using RFlutter_Alert Library Package.
What is Alert Dialog box?
Alert Dialog Box is basically a Box pop up which display some kind of Message or any action.It is normally used to ask the app user whether he want to continue to next process or discontinue.
Introduction to RFlutter Alert
RFlutter Alert is super customizable and easy to use alert/popup dialog for flutter app development. You may create reusuable alert styles or add buttons.
Now you are done with importing the RFlutter Alert Library package into your Flutter Application.
Implementation of Flutter Alert dialog box
There are many ways to show a alert dialog box, but in the post will we see 4 customized way to implement Flutter Alert dialog box pop up.
1. easiest way to create RFlutter Alert
The easiest way for creating RFlutter Alert.
This is a snippet code, Complete code for this project will be at the bottom.
Alert(
context: context,
title: "RFLUTTER ALERT",
desc: "Proto Coders Point, Flutter alert dialog box is more awesome with RFlutter Alert.")
.show();
The easiest way to display a alert dialog box in flutter is that just to display a title with some text in it and a description with some information of message.
easiest way to create RFlutter Alert
This default alert dialog will come up a default cancel button with it to just close the dialog box.
Alert Dialog with 2 Buttons, Here i have created a dialog with 2 button in it. One button is to accept the alert and second button is to decline the alert message.
Alert dialog with 2 Button in RFlutter Alert
Then, i have also customized the button with gradient color feature.
3. Alert dialog with Login Content in RFlutter Alert
Hi Guys welcome to Proto Coders Point. In the Post we will learn how to implement a Widget that is a ToggleButton in Flutter App development.
This is How the Final Flutter App Output will look like
flutter app development toggle button
What is a ToggleButton Widget?
Checked / unchecked (On / Off) status can be displayed on the button using the a ToggleButton widget. If the user has to change the setting between two states, it is beneficial. On / Off Audio Sound, Wifi etc. In such case we make user of a Togglebutton in web, android or flutter app development.
Implementation of Togglebutton in flutter app development using android-studio.
So lets begin the implementation of ToggleButton, I am using android-studio to build the app.
Here, we have a ToggleButtons which has children array of widget which consist of 3 Icons, which allows for multiple Buttons to be simultaneously selected.
Complete code for implementation of flutter widget ToggleButtons
Android Tutorial on Volley library – How to Fetching JSON Data from URL
Hey guys, welcome to Proto Coders Point. This Tutorial post is all about implementing Android Volley Library Tutorial. I have a URL on our website that gives me some JSON format data, and by using Volley library we will get those data, and we will also parse it. Ok So if you want to learn how to fetch json data from a URL in android and display it in Listview then let’s start this Android Tutorial on Volley library.
Before Starting Implementation let us know Basic of Volley Library.
What is Android Volley?
If you are new in android then you might be thinking what is this Volley library?
Volley is an HTTP library that makes networking very easy and fast, for Android application development.
What are benefits of Android Volley?
Easy to use request management
Fast in fetching data from Any network.
Efficient network management
Easily customizable according to our need.
Android Tutorial on Volley library Implementation in android Studio.
Demo Output of android volley Library project
android volley library tutorial project
Now it’s time for implement library, As i have told you above that i have a URL that contain JSON Data Format.
Then if you are implementing this project then you can use same URL for your project Practice or Create your own JSON Data.
If you open the above URL, you will see the following JSON DATA .
{
"superheros": [
{
"name": "Flash",
"power": "Speed Run :.............."
},
{
"name": "Super Man",
"power": "the powers of flight, ................."
},
{
"name": "Thor",
"power": "Superhuman strength, ........"
},
{
"name":"Hulk",
"power":"Incredible superhuman strength, ......."
},
{
"name":"Vemon",
"power":"Venom also has super strength — ........"
}
]
}
Now As you can see in above Screenshot Image we have some JSON data. At first, we have a JSON object { }, then inside that object, we have a key name superheros which contain array of JSON objects. Each object in the array has two more keys name and power. So In this android project our task is that to fetch this data and display it into a custom ListView.
Creating a new project under android-studio
As always the basic step in any development if creating a new Project.
when the project is been created successfully, we need to add uses-permission with INTERNET as we are about to perform a network Data fetch operation and it requires internet permission.
Adding internet Permission
Open the AndroidManifest.xml file under you project and you need to add internet permission as shown below.
For your application to work freely on Android Pie ( 9 ) and above you need to add uses-library org.apache.http.legacy inside application tag
Check out below screenshot for this
uses-library org.apache.http.legacy
Adding Volley Library
This is the very important step. As we are going to use volley library.
adding android volley library
navigate towords project
Gradle Scripts > build gradle (Module:app) > under dependencies add below lines of codes
As you can see that i have used ProgressBar that because when the fetching of data is going on we can show a progress bar until the data is fetched completed.
Then we would need a layout for our list items.
Inside the layout directory (res->layout) you need to create a new layout resource file and name it i have named it as list_items.xml.
Here we have two string items i.e (name and power) in our json data, So we created two TextViews here to display the fetched data here.
Creating a Custom Adapter for listview
For this you need to create a new java class,i have named it as ListViewAdapter.java and copy the below code in that java Adapter class .
package protocoderspoint.com.volleyandroidpractices;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
import java.util.List;
public class ListViewAdopter extends ArrayAdapter<SuperHero> {
//the hero list that will be displayed
private List<SuperHero> superHeroList;
//the context object
private Context mCtx;
//here we are getting the herolist and context
//so while creating the object of this adapter class we need to give herolist and context
public ListViewAdopter(List<SuperHero> superHeroList, Context mCtx) {
super(mCtx, R.layout.list_items, superHeroList);
this.superHeroList = superHeroList;
this.mCtx = mCtx;
}
//this method will return the list item
@Override
public View getView(int position, View convertView, ViewGroup parent) {
//getting the layoutinflater
LayoutInflater inflater = LayoutInflater.from(mCtx);
//creating a view with our xml layout
View listViewItem = inflater.inflate(R.layout.list_items, null, true);
//getting text views
TextView textViewName = listViewItem.findViewById(R.id.textViewName);
TextView textViewImageUrl = listViewItem.findViewById(R.id.textViewPower);
//Getting the superHero for the specified position
SuperHero superHero = superHeroList.get(position);
//setting superHero values to textviews
textViewName.setText(superHero.getName());
textViewImageUrl.setText(superHero.getPower());
//returning the listitem
return listViewItem;
}
}
Now we are in the last part that is fetching and parsing the json and displaying it to the ListView.
Fetching JSON Data from URL
Open MainActivity.java file and paste the below lines of code.
package protocoderspoint.com.volleyandroidpractices;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class MainActivity extends AppCompatActivity {
//the URL having the json data
private static final String JSON_URL = "https://protocoderspoint.com/jsondata/superheros.json";
//listview object
ListView listView;
//the hero list where we will store all the hero objects after parsing json
List<SuperHero> superHeroList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//initializing listview and hero list
listView = (ListView) findViewById(R.id.listView);
superHeroList = new ArrayList<>();
//this method will fetch and parse the data
loadHeroList();
}
private void loadHeroList() {
//getting the progressbar
final ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
//making the progressbar visible
progressBar.setVisibility(View.VISIBLE);
//creating a string request to send request to the url
StringRequest stringRequest = new StringRequest(Request.Method.GET, JSON_URL,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
//hiding the progressbar after completion
progressBar.setVisibility(View.INVISIBLE);
Log.d("Json Response",response);
try {
//getting the whole json object from the response
JSONObject obj = new JSONObject(response);
//we have the array named hero inside the object
//so here we are getting that json array
JSONArray heroArray = obj.getJSONArray("superheros");
//now looping through all the elements of the json array
for (int i = 0; i < heroArray.length(); i++) {
//getting the json object of the particular index inside the array
JSONObject heroObject = heroArray.getJSONObject(i);
//creating a superHero object and giving them the values from json object
SuperHero superHero = new SuperHero(heroObject.getString("name"), heroObject.getString("power"));
//adding the superHero to herolist
superHeroList.add(superHero);
}
//creating custom adapter object
ListViewAdopter adapter = new ListViewAdopter(superHeroList, getApplicationContext());
//adding the adapter to listview
listView.setAdapter(adapter);
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//displaying the error in toast if occurrs
Toast.makeText(getApplicationContext(), error.getMessage(), Toast.LENGTH_SHORT).show();
}
});
//creating a request queue
RequestQueue requestQueue = Volley.newRequestQueue(this);
//adding the string request to request queue
requestQueue.add(stringRequest);
}
}
In my sincere opinion – future seems shiny bright for Flutter. Time is ripe for alternate.
Java/Kotlin and Swift/objective-C lets in one to broaden handiest for Android and iOS respectively when it comes to developing apps.
however, Flutter framework opens doorways to cross-platform improvement surroundings. for this reason, very quickly human beings would want emigrate to a greater versatile platform, subsequently Flutter would upward thrust to glory.
future of flutter app developer
Tutorial I Purchased to learn Flutter – future
For getting to know app improvement, I followed more than one blogs, diverse Flutter programming and books, few video tutorials – both paid and loose.
However none could may want to make my sail a clean experience. It changed into only in March 2019 that I landed up on a video direction that modified the entirety for proper and brought me to pen this answer.
those who are searching ahead to learning cross-platform app development, i am bringing up the link to the course that helped me come to be an App Developer, you may locate it useful – The Complete 2020 Flutter Development Bootcamp with Dart
Which i have personally purchased and learn a lot about cross-platform app development as it as the future of flutter.
What you’ll learn in this flutter udemy course?
fast and native-quality apps with Flutter Build beautiful,
Become a fully-fledged Flutter developer
Build Android and iOS apps with just one codebase
Android and iOS apps building using just one programming language (Dart)
You can build a portfolio of Flutter apps to impress any Job recruiter
You will easily Understand all the fundamental concepts of Flutter Apps development
Become proficient in one of the fastest growing technologies
What is the future scope of Flutter?
I guess that the future scope is to become a successful cross-platform environment flutter for building great mobile apps for iOS, Android.
You want to be aware that for a brand new project like Flutter some things may want more work due to the fact no ready-to-use packages are to be had, however the Flutter community is quite energetic and new packages are added every day to Dart Package and i expect the frequency to growth loads when Flutter 1.0 will be release in all likelihood inside the no longer too far destiny.
In this tutorial i will show you how to make an Infinite Cycle View Pager with On Click Listner.
INFINITE CYCLE VIEW PAGER
Demo Screen Recorded
This Github Android Library comes with with two-way orientation i.e Horizontal and Vertical Orientation and interactive effect.
In a normal ViewPager, you are allowed only to scroll from the first page to second page until the last Page, from left-to-right. Once you reach the last page, your only option is to scroll backwards, right-to-left. In other words if we say from last page you cannot go back to first page directly, you need to scroll backwards until first page. Therefore I have found a infinite cycle ImageView Card ViewPager that solve the a problem.
Installation of Infinite Card ViewPager in project.
Let us now start adding required dependencies library into our android studio project.
Minimun SDK Version required for this library:
InfiniteCycleViewPager requires a minimum SDK version of 11.
Add Github Dependenices library in to Gradle (Module:app)