Category: Android

Application lifecycle management is the process of managing an app’s development, from design to final release, and establishing a framework for managing changes.

The typical application lifecycle starts with the design of a new app or feature. The app is planned based on requirements analysis and specifications. After that, the app is implemented as per the specifications and then tested. The new app is staged for final testing before it gets deployed to production.

This cycle repeats for every new app or feature. It’s also used for app maintenance, such as when features are enhanced, or bugs are fixed.

To follow the above approach, we should follow AGILE methodology to get it done.  In this process, that start somewhere in the business as an idea, a need, a challenge or a risk and then pass through different development phases such as

  • Requirements definition
  • Design
  • Development
  • Testing
  • Deployment
  • Release and maintenance

In this process each of these steps is closely monitored and controlled, followed by proper tracking and documentation of any changes to the application.

Today, it is more likely that developers will use agile model and remain involved with the application after deployment, working with business owners and operations to make incremental changes as needed.

Some of our article related to app development process :

How To Develop Mobile Event App

Why firebase is the best as a Mobile Application backend?

Read More Application Lifecycle Management- How It is Useful in Mobile App Development for Business

Android iPhone Mobile Development Trends

Firebase for Mobile Application, By using Firebase we can be created quickly powerful and scalable application and the best thing is we do not worry about server end, everything is managed by firebase itself.we do not need to call API and managed databases so half of the work is done by firebase. It is fully managed platform to develop Ios Application, Android Application, and Web Application. It is fully filled with the feature. Firebase is different from Google Service Platform.  Since Google I/O 2016 there have been some major updates to Firebase. Below is information related to the legacy service.

Some Feature of Firebase :

1>Authentication: Firebase Authentication provides backend services for the mobile application.t supports authentication using passwords, phone numbers, social networking identity providers like Google, Facebook and Twitter, and more. we do not need server API firebase authentication provides security. For firebase Auth we need to add dependencies :

implementation 'com.google.firebase:firebase-auth:11.8.0'
For example we see login with mobile number and verify OTP with firebase:
FirebaseAuth auth ;
Firest initialize fiebase Auth in onCreate() method:
auth = FirebaseAuth.getInstance();

and then

String phone = mobile_editText.getText().toString();

private void sendVerificationCode(String phoneNumber, PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks) {
    PhoneAuthProvider.getInstance().verifyPhoneNumber(
            "+91" + phoneNumber,        // Phone number to verify
            60,                 // Timeout duration
            TimeUnit.SECONDS,   // Unit of timeout
            Signup_Activity.this,               // Activity (for callback binding)
            mCallbacks);        // OnVerificationStateChangedCallbacks
}

PhoneAuthProvider.OnVerificationStateChangedCallbacks mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
    @Override
    public void onVerificationCompleted(PhoneAuthCredential credential) {

        Log.d(TAG, "onVerificationCompleted:" + credential);
        _credential = credential;
        if (_credential.getSmsCode() != null) {
            otp_editText.setText(_credential.getSmsCode());
            submitMethodCalled();
        } else {
            signInWithPhoneAuthCredential(credential);

        }
    }

    @Override
    public void onVerificationFailed(FirebaseException e) {

        Log.w(TAG, "onVerificationFailed", e);

        Singleton.hideLoader();
        if (e instanceof FirebaseAuthInvalidCredentialsException) {
            // Invalid request
            verification_text.setVisibility(View.VISIBLE);
            verification_text.setText(e.getLocalizedMessage());
            verification_text.setTextColor(getResources().getColor(R.color.green));

        } else if (e instanceof FirebaseTooManyRequestsException) {
            // The SMS quota for the project has been exceeded
            verification_text.setVisibility(View.VISIBLE);
            verification_text.setText("SMS quota for the project has been exceeded");
            verification_text.setTextColor(getResources().getColor(R.color.green));
        }


    }

    @Override
    public void onCodeSent(String s, PhoneAuthProvider.ForceResendingToken forceResendingToken) {
        super.onCodeSent(s, forceResendingToken);

        codesent = s;
        verification_text.setText("Verification code has been sent");
        otp_editText.setText("");
    }
};


private void submitMethodCalled() {

    if (_credential != null)
        signInWithPhoneAuthCredential(_credential);
    else {

        String code = otp_editText.getText().toString();
        // [START verify_with_code]
        _credential = PhoneAuthProvider.getCredential(codesent, code);
        // [END verify_with_code]

        signInWithPhoneAuthCredential(_credential);
    }
}

private void signInWithPhoneAuthCredential(PhoneAuthCredential credential) {
    mAuth.signInWithCredential(credential)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    if (task.isSuccessful()) {
                     Toast.makeText(getApplicationContext(), "your verification code is valid", Toast.LENGTH_LONG).show();
                     //do own codewhich you want to do on login success

 } else {
 if (task.getException() instanceof FirebaseAuthInvalidCredentialsException) {
 
 Toast.makeText(getApplicationContext(), "your verification code is invalid", Toast.LENGTH_LONG).show();
 }
 }
 }
 });
}

2>Hosting: Firebase Hosting provides static content hosting.Firebase Hosting is production-grade App content hosting for developers.with using firebase hosting we can create quickly and easily develop the mobile application. Firebase hosting develope modern mobile application. Hosting gives your project a subdomain on the domainfirebaseapp.com. Firebase Hosting offers lightweight configuration options for you to build sophisticated Progressive Web Apps. You can easily rewrite URLs for client-side routing or set up custom headers.

3>Real Time Database: Real-time Database instance and automatically receive updates with the newest data. The Realtime Database provides a flexible, expression-based rules language, called Firebase Real-time Database Security Rules, to define how your data should be structured and when data can be read from or written to. When integrated with Firebase Authentication, developers can define who has access to what data, and how they can access it.

4>Cloud Messaging: Firebase cloud messaging from Google gives an ability to send and receive messages from the client, It is a cross-platform system and it is completely free and it has no limitations. Messages and notifications can be sent to the client app using the app server or the Firebase notifications console. To send push notification in mobile application use firebase cloud messaging.

To send Firebase Cloud Messaging in your app by two types:

i>Notification Message: In Notification messages type of messages are automatically displayed to end user.

ii>Data Message: In Notification messages type of messages is automatically displayed to end user.

To receive these messages in MyFirebaseMessagingService class file on:

@Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        if (remoteMessage.getData().size()>0) {

            String title = remoteMessage.getData().get("title");
            Intent intent = new Intent(Config.PUSH_NOTIFICATION);
            intent.putExtra("title", title);

            LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this);
            localBroadcastManager.sendBroadcast(intent);

        }
And write below code in your class file: 
private BroadcastReceiver mHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
   //To initialize broadcastReceiver in your activity
    LocalBroadcastManager.getInstance(this).registerReceiver(mHandler, new IntentFilter("your package name"))
    setContentView(R.layout.activity_main);
}
And then below code is add in onCreate() where you want to show messages and count of messages
//To receive notification in foreground where you want to show messages
mHandler = new BroadcastReceiver() {
    @Override
    public void onReceive(Context context, Intent intent) {
        if (intent.getAction().equals(PUSH_NOTIFICATION)) {
            // new push notification is received
            String message = intent.getStringExtra("message");
            showReceiveMessageDialog(message);
        }
    }
};
To receive messages when app is in foreground:
//push notification in background
if (getIntent().getExtras() != null) {
    String message = getIntent().getExtras().getString("message");
    showReceiveMessageDialog(message);
}
write this code in your activity class file where you want to receive messages:
 @Override
 protected void onResume() {
 super.onResume();

 // register new push message receiver
 // by doing this, the activity will be notified each time a new message arrives
 LocalBroadcastManager.getInstance(this).registerReceiver(mHandler,
 new IntentFilter(PUSH_NOTIFICATION));

 // clear the notification area when the app is opened
 NotificationUtils.clearNotifications(getApplicationContext());
 }

 @Override
 protected void onPause() {
 LocalBroadcastManager.getInstance(this).unregisterReceiver(mHandler);
 super.onPause();
 }

And please add services in your Manifest file to receive push notification from firebase.

Add Firebase to your application
  • Create an account on Firebase.
  • Create a project in Firebase console.
  • Click Firebase for Android app and follow the instructions.
  • When prompted, enter app’s package name.
  • Download google-services.json file.
  • Place google-services.json file in your app’s module folder. Typically /app.

 

Add  dependencies on your app

dependencies {

classpath ‘com.android.tools.build:gradle:2.2.0-rc1’

classpath ‘com.google.gms:google-services:3.0.0’

}

To Add Firebase messaging dependency

dependencies {

compile ‘com.google.firebase:firebase-messaging:9.6.0’

}

apply plugin: ‘com.google.gms.google-services’

 

Conclusion: Firebase plays the vital role in the development of mobile application in IOS and ANDROID mobile. By using firebase you can manage data from firebase to send the notification, store real-time database, it manages half of the work itself.

 

Read More Why firebase is the best as a Mobile Application backend?

Android

 

AGILE methodology is a methodology which provide continuous iteration of development and testing  the software development lifecycle of the project. Development and testing of the software activities are opposite of waterfall model. There are various agile development methods  like scrum,crystal methodologies,dynamic software development method,feature driven development ,lean software development and extreme programming.

Scrum

Scrum is an agile development method which  focus  on how to manage tasks within a team . Scrum is use for empowering team and working in small team for improve software.
It consists of three roles, and their responsibilities are explained as follows:

  • Scrum Master
    • Master is responsible for setting up the team, sprint meeting and removes obstacles to progress
  • Product owner
    • The Product Owner creates product backlog, prioritizes the backlog and is responsible for the delivery of the functionality at each iteration
  • Scrum Team
    • Team manages its own work and organizes the work to complete the sprint or cycle

Product Backlog

This is a repository where requirements are tracked with details . It should be maintained and prioritized by Product Owner, and it should be distributed to the scrum team. Team can also request for a new requirement addition or modification or deletion

Process flow of Scrum Methodologies:

Process flow of scrum testing is as follows:

  • Each iteration of a scrum is known as Sprint
  • Product backlog is a list where all details are entered to get end product
  • During each Sprint, top items of Product backlog are selected and turned into Sprint backlog
  • Team works on the defined sprint backlog
  • Team checks for the daily work
  • At the end of the sprint, team delivers product functionality

Most of the company follow Agile methodology for mobile application development . We can provide early and ongoing delivery of the software and app modules to our valuable clients with the help of agile methodology. We have found that mobile application development  process becomes more quick, easy and efficient using agile technology. Agile technology provides lightweight development process and value to build applications in short cycles with quality check in every step.

Benefits of agile methodology :

  • Visibility
  • Cost Control
  • Simple design
  • Personalization
  • Ability to adapt to changes
  • Focuses on Business Value
  • Predictable Costs and Schedule
  • Even late changes in requirements are allowed

                  Waterfall Vs  Agile methodology

waterfall_model

agile

Waterfall Model

Waterfall development is  not allow much reflection or revision. Once an application is in the testing stage, it is very difficult to go back and change something that was not well-documented or thought upon in the concept stage.

      The major disadvantages of the Waterfall Model are as follows
  • No working software is produced until late during the life cycle.
  • High amounts of risk and uncertainty.
  • Not a good model for complex and object-oriented projects.
  • Poor model for long and ongoing projects.
  • Not suitable for the projects where requirements are at a moderate to high risk of changing. So, risk and uncertainty is high with this process model.
  • It is difficult to measure progress within stages.
  • Cannot accommodate changing requirements.
  • Adjusting scope during the life cycle can end a project.

Agile Methology

       The major disadvantages of the Waterfall Model are as follows
  • Rapid, continuous delivery of useful software is satisfied the customers.
  • People and interactions are emphasized rather than process and tools. Customers, developers and testers constantly interact with each other.
  • Working software is delivered frequently (weeks rather than months).
  • Face-to-face conversation is the best form of communication.
  • Close, daily cooperation between business people and developers.
  • Continuous attention to technical excellence and good design.
  • Regular adaptation to changing circumstances.
  • Even late changes in requirements are welcomed.

Agile methodology execution

Agile_Project_Management_by_Planbox

Step1 :  First Team will analysis requirement.
Step 2 : Designers will Design Application.
Step 3 : Developers will Build Application.
Step4 :  QA team will ensures excellent Quality for the application.
Step5 : We will take the feedback from our client if modifications or issues are there then
process will be continue
Step6 : If there is no any issues then successful Mobile Application will be delivered to the client.

Conclusion:

If you want to be agile, the first tenet is “Every project needs a slightly different set of
policies and      conventions, or    methodology.” People’s attitude toward communication, user
involvement, and frequent releases is more important than the specific process you use.

Read More Agile Methodology for mobile application development

Android iPhone

App Performance for Android?

Implementing a great app depends upon which necessary key factors is developed while building the application. Because of unnecessary things which will degraded app performance at runtime. These some of factors to communicate your app’s performance. For example, users want apps that:

Start up quickly.

Respond quickly to user interaction.

Bugs and Crashes Free.

Minimum APK size, etc.

Let’s see what are the 8 key features to improve the performance of app:

1. Optimize for Battery life:

Battery life is the most important aspect of the mobile user experience. A device without power offers no functionality at all. For this reason, it is critically important that apps be as respectful of battery life as possible.

2. Reduce the APK size:

Users often avoid downloading apps that seem too large, Allow new users to download your application. they first prefer what is APK size to download the app.beacuse of memory management is performs the big role in low memory devices. In India, low memory devices are used on a large scale.

3. Manage your app’s memory:

Random-access memory (RAM) is a valuable resource in any software development environment, but it’s even more valuable on a mobile operating system where physical memory is often constrained. Although both the Android Runtime (ART) and Dalvik virtual machine perform routine garbage collection, this does not mean you can ignore when and where your app allocates and releases memory.

You still need to avoid introducing memory leaks, usually caused by holding onto object references in static member variables and release any reference object at the appropriate time as defined by lifecycle callbacks.

4. Design for Seamlessness:

Even if your application is fast and responsive, certain design decisions can still cause problems for users because of unplanned interactions with other applications or dialogs, accidental loss of data, blocking, and so on.

To avoid these problems, it helps to understand the context in which your applications run and the system interactions that can affect your application. In short, you should make to develop an application that interacts seamlessly with the system and with other applications.

5. Keeping your app Responsive:

It’s possible to write code that wins every performance test in the world, but still feels sluggish, hang or freeze for significant periods, or take too long to process input. The worst thing that can happen to your app’s responsiveness is an “Application Not Responding” (ANR) dialog.

In Android, the system guards against applications that are insufficiently responsive for a period of time by displaying a dialog that says your app has stopped responding.

6. Avoid creating unnecessary Objects:

A generational garbage collector with per-thread allocation pools for temporary objects can make allocation cheaper, but allocating memory is always more expensive than not allocating memory.

As you allocate more objects in your app, you will force a periodic garbage collection, creating like degraded user experience.

7. Prefer static, over virtual Objects:

If you don’t need to access an object’s fields, make your method static. Invocations will be about 15%-20% faster. It’s also good practice because you can tell from the method signature that calling the method can’t alter the object’s state.

8. Remove unwanted Dependencies (Libraries):

If we use selective and necessary dependency will directly relate to memory management and it keeps much faster to read data. so remove unused dependencies and use only those dependencies which are important.

Conclusion:

To improve the application performance try to generate limited amount code and reusable functions to maintain data size. Also use relative functions, tools or plugins if necessary. else remove not used functions and irrelevant code to boost up app performance.

Read More What are the 8 key features to improve the performance of your app?

Android Mobile Development

The latest player to play on mobile for music song i.e. Exoplayer

Exoplayer is an application level Media Player Library.ExoPlayer standard audio and video components are built on Android’s MediaCodec API, which was released in Android 4.1 .It is an adaptive audio and video streaming.Because ExoPlayer is a library, you can easily take advantage of new features as they become available by updating your app.I have been use MediaPlayer to stream a song but problem is song stream in approx all mobile except redemii and latest android 7 mobile thats why we use Exoplayer to stream song ,when we use Exoplayer to stream audio and video song there is no problem to play song.Exoplayer is very fast and smooth audio and video songs.

Feature of Exoplayer:

1>Exoplayer is an application level Media Player Library.

2>It works on all mobile to stream audio and video songs.

3>It is very fast and smooth player to stream an audio and video songs.

4>Ability to run the very same Player version on all devices.

How to use Exoplayer :

1>First add dependency in build.gradle:
dependencies {
compile ‘com.google.android.exoplayer:exoplayer:r1.5.3’
}
It is very important to  allow  import exoplayer in your activity.

2> Inintialise Exoplayer in onCreate method
ExoPlayer exoplayer;//It is declare globally in your activity.
exoplayer = ExoPlayer.Factory.newInstance(1);
In your activity First initialize Exoplayer in onCreate method
3>Write this code where you want to stream audio player

MediaCodecAudioTrackRenderer audioRenderer = null;
Allocator allocator = new DefaultAllocator(BUFFER_SEGMENT_SIZE);
String userAgent = Util.getUserAgent(localContext, “ExoPlayerDemo”);
DataSource dataSource = new DefaultUriDataSource(localContext, null, userAgent);
ExtractorSampleSource sampleSource = new ExtractorSampleSource(Uri.parse(_uri),
dataSource, allocator, BUFFER_SEGMENT_SIZE * BUFFER_SEGMENT_COUNT);
audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
mediaPlayer.prepare(audioRenderer);

mediaPlayer.setPlayWhenReady(true);

Where _uri is Url of songs.

Method To Play ExoPlayer

public void playMedia() {
if (!mediaPlayer.getPlayWhenReady()) {
isPlaying = true;
isPause = false;
mediaPlayer.setPlayWhenReady(true);
}

}

This is the method to call for stream  a song and play.Inwhich isPlaying and isPause is a boolean value.

Method to pause media player:

public void pauseMedia() {
if (mediaPlayer.getPlayWhenReady()) {
isPlaying = false;
isPause = true;
mediaPlayer.setPlayWhenReady(false);
}
}

This is the method to call for pause a song.Inwhich isPlaying and isPause is a boolean value.

Method to stop media player

if (mediaPlayer.getPlayWhenReady()) {
mediaPlayer.stop();
}

This is the method to call for stop a song.

Conclusion:

Exoplayer is a powerful concept to stream an audio and video songs.It is very fast and smooth player.When we use Exoplayer Stream an audio and video song on all mobile,there is no problem in any mobile in stream a song.

Read More Media Streaming With Exoplayer

Android

What is Play Store?

Play Store is a digital distribution service operated and developed by Google. It serves as the official app store for the Android operating system.

Play Store also called Marketplace. We can install any app on Play store on all android devices.  It acts as Store or Home of Official developed android apps by developers around the world.  Play Store provides a huge amount of Android apps available and we can access from anywhere using internet connection.

Play Store provides categories of apps to install on Android devices like Art & Design, Communication,  Education, Entertainment, Games, Health & Fitness, Maps & Navigation, Travel & Local, Finance, etc.

According to Google, the number of available applications in the Google Play Store from December 2009 to December 2017 is 3.5 million apps in December 2017, after surpassing 1 million apps in July 2013. As per Comparison, Apple’s App Store remained the second-largest app store with 2.2 million available apps.

Let’s see what are the ways in which Need of Android Application in Play Store and how empowers the app industry and positively affects the mobile application market:

Platform :

Google provides official Android App (Play Store) to the Android Developers and Android Users. The motto of the Play Store is android user can install a variety of apps from this platform and having free as well as paid apps.

Security:

Play Store provides Play Protect feature is an evolution of the Google’s “Verify Apps” service.  The feature, which will be enabled by default on all Android devices, is meant to be a real-time malware scanner that will scan every installed or about-to-be installed app and inform users in case there’s something amiss.

Popularity:

Millions of Android compatible state of the art application are available in play store. As per the analysis, Google’s Android Play Store is the Topmost app store in the world and the tough competitor to its Apple’s App Store is holds the second-largest position.

Conclusion:

Google provides its official Play Store and having security, reliability to choose millions of apps but many of the third-party apps are available on various websites which is not available in play store. The reason behind that these apps are Dangerous work via malicious advertising or even code. While not all third-party apps are “bad,” many stores bait users by offering popular apps for much cheaper prices and subsequently put user privacy very much at risk. Examples of sensitive information extracted through third-party app stores include phone numbers, device information, and email addresses.

So we can always prefer a security while using an Android device, Google provides more security day by day and Google having rights to ban suspicious and malicious apps available on play store.

Read More Need of Android Application In Marketplace

Android Trends

There are approximately 1.3 million Android apps in the Google Play store and 1.2 million apps in Apple’s App Store, used by nearly two billion smart phone users worldwide.

App Store Optimization is an ongoing process. A successful ASO strategy requires a keen eye, and regular check-ins, regular update on store, use of proper keywords etc.

How to do App Store Optimization (ASO)?

You currently have an advantage because many organizations are not optimizing their apps properly. And due to app store optimization, you can make your application on the top the search result.

To help you boost your app marketing strategy I’ve put together a list of 10 Ultimate ASO tips:

 

1.        Understand your customer and your competition

2.        Start with Descriptive title

3.        Use keywords wisely

4.        Describe your app well with proper keyword

5.        Pick the Right Category

6.        Focus on icon Design

7.        Focus Android Apps, should make Google+ Profile

8.        Include Good screenshots and video

9.        Increase traffic with outside promotion

10.     Update frequently of your application

Conclusion

If you want to have a successful app with lots of visibility and downloads — and income-generating potential — you’ve to pay attention on your app’s ASO.
For Any types of inquire Please do contact us at http://wwww.kodesoft.in

Read More The App Store Optimization Checklist- 10 Ultimate Tips

Android Digital Marketing iPhone Mobile Development Trends

Introduction of Kotlin

Kotlin is a statically-typed, inferred and functional programming language which is developed by “JetBrains” developers in 2011.JetBrains developers are the main team member who invented Kotlin programming language.Kotlin name is kept from Kotlin island which is near in Saint Petersburg, Russia.
Preview release date: 31 March 2017
Stable release date: 25 April 2017
Kotlin is the combination of multiple languages, for example, something is taken from Scala programming language, something is taken from C++ and something is taken from java etc, and it comes with no limitations.
It also runs in Java Virtual Machine and firstly converted in bytecode and etc. One of the main motives of Kotlin is to compile as fast as java.And one of the main reason to invent Kotlin is to overcome java problems.

Features of Kotlin :
Kotlin introduces many improvements for programmers such as :

1) Kotlin setup is very easy, simply a plugin is available in android studio upload plugin and one option showed that is setup configure Kotlin and click and Kotlin configure automatically.

2)Kotlin is concise which means the code of amount is reduce as compare to other languages.
3)Kotlin is safe means Null-Pointer Exception which is the major problem in Java, which is eliminated in Kotlin.In Kotlin you can create two types of a variable (nullable variable and non-null variable), if you want to create null variable then choose a nullable variable and if you want to create non-null value then choose a non-null variable, it gives error msg not a null-pointer exception.

4)Kotlin is Interoperable means you can easily convert Kotlin program in java and if you want to convert java program in Kotlin then you can easily convert.

 

5)Kotlin is the third language which is fully supported by Android after Java and C++.
6)Kotlin is a completely open source and free in cost and gives one option to convert java to Kotlin and a strong focus on java binary compatibility.
7)It is intended to improve code readability, gives an easier way to extend Android SDK classes and speed up development.

8) In Kotlin, there is no need to write semicolon “;”, without writing semicolon you can run your app.In C, C++, JAVA, Android without semicolon crash your project.
How to use Kotlin:
1: How to declare variables and data types in Kotlin
It declares in two way
i) The first way in which you did not need to pass data type called implicit conversion:
var fruit = “Mango”
val count = 100
Here, fruit is a variable of type String data type, and the count is a variable of type Int data type. You don’t have to specify the types of variables, Kotlin implicitly does that. The compiler knows this by initializer expression (“Mango” is a String, and 100 is an integer value). This is called type inference in programming.
The difference between var and val:
val is an Immutable reference which means the variable declared using val keyword cannot be changed once the value is assigned. It is similar to final variable in Java.
var is the Mutable reference which means the variable declared using var keyword can be changed later in the program. It corresponds to regular Java variable.
ii) second if you want to define data type called explicit conversion:
val a:Int = 6266
Means value convert to integer type
val a:Long = 2000L
the in which compiler considers long data type.Suffix “L” means it converts in long data types.
2>Charecter, String and their functions in Kotlin:
Syntax: class Student(val firstName: String, var age: Int) {
// class body
}
3>Array in Kotlin:
Arrays in Kotlin are represented using the Array class. You can create an array in Kotlin either using the library function arrayOf() or be using the Array() constructor.
You can pass a bunch of values to the arrayOf function to create an array :
var numbers = arrayOf(1, 2, 3, 4, 5)
var animals = arrayOf(“mango”, “jackfruit”, “banana”, “apple”)
var mixedArray = arrayOf(1, true, 3, “hello”, ‘A’)
how to use array in kotlin:
fun main(args: Array<String>){
var array = arrayof(123,234,765)
println(“${array[0]}”) // To print 0th position value of array

for(i in array){
println(“${array[i]}”) //To print all value of array use for loop:
}
}

4>Class and Constructor in kotlin:
Syntax: class student
If you do not want to add body of class then there is no need to add curly braces.if you want to add body of class then need to use curly braces:
Syntax: class student {
//body of class
}
How to call Constructor :student()
fun main(args: Array<String>){
var s = student() //Here call student constructor
}

Conclusion:

Kotlin is a new language with low risk and easy to learn, you stay in the familiar Java ecosystem and you can start using Kotlin alongside with Java.

Read More Top 8 Things You Need To Know About Kotlin, Android’s New Programming Language

Android

Singleton class  which is created in java for  global point of view. Singletons are useful to provide a unique source of data or functionality to other Java Objects. In android Singleton class creates only one instance.

Benifit  to use of Singleton class in android:

Purpose to use  Singleton class is control to create number of object  creation in project and limiting the number of objects.

Suppose you made a app to play song through service,In this case you can use singleton class concept.Inwhich media player declare in service as a globally and use media player in any where of app,by using concept of singleton class concept.Means you create object of singleton class in activity inwhich you want to use singleton class value .And use mediaplayer globally you don’t need to create another object of media player.

Here is the process to use Singleton class:

This is Arraylist which is globally declare in Singleton class

public ArrayList<String> arraylist  = new ArrayList< String >();
Singleton class is:

// File Name: Singleton.java

    public class Singleton {
private static final Singleton instance = new Singleton();
public ArrayList<SubCatogry_Pozo> arraylist = new ArrayList<SubCatogry_Pozo>();
// /* A private Constructor prevents any other    * class from instantiating.    */
public Singleton() {
}

/* Static ‘instance’ method */
public static Singleton getInstance() {
return instance;
}
}

Here is  SubCatogry_Pozo  is  your pozo class of app.And arraylist which is globally declared in singleton class and use this arraylist through singleton class object.

And then use this singleton class in any activity in project ,To use this Singleton class in another Activity just create object of Singleton class

//Create object of Singleton class
Singleton singleton =Singleton.getInstance( );

And use arraylist through object of Singleton class i.e.

singleton. arraylist.add(value);

value which you want to add in arraylist and here is class inwhich you want to use arraylist of singleton class.

// File Name: MainActivity.java

public class MainActivity extends Activity{

Singleton singleton =Singleton.getInstance( );   

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
   singleton. arraylist.add(value);

}

}

The Singleton class maintains a static reference to the  singleton instance and returns that reference from the static getInstance() method.

Read More Singleton class

Android Mobile Development

Dialog box is a small window that prompts the user to make a decision or enter additional information. A dialog does not fill the full-screen and is normally used for modal events that require users to take an action before they can proceed.

And a Custom-dialog-box is same as dialog-box only difference is that in custom dialog-box you design dialog-box  on  your requirement. For Example- create dialog-box to enter four digit OTP number  in Which  you  take  four edit Text  with  equal distance to enter password and take one  “submit “ button.

 To create Custom-dialog-box follows step-by-step:

i)First create a new project in android studio and design layout for dialogBox.

 Android Layout File:

XML file, for custom  dialog.

File : res/layout/custom_dialog.xml

To, design layout you set  accordingly  margin,padding-left,right,top and bottom,height and width etc.

<LinearLayout

android:id=“@+id/layout_header”
android:layout_width=“match_parent”
android:layout_height=“44sp”
android:background=“@color/light_green”>

<TextView
android:layout_width=“match_parent”
android:layout_height=“44sp”
android:gravity=“center”
android:text=“Enter One Time Password”
android:textColor=“@color/white”
android:textSize=“@dimen/dm_20sp” />

</LinearLayout>
<LinearLayout
android:id=“@+id/layout_otp”
android:layout_width=“match_parent”
android:layout_height=“@dimen/dm_90sp”
android:layout_below=“@+id/layout_header”
android:orientation=“horizontal”>

<EditText
android:id=“@+id/editTextone”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”
android:nextFocusRight=“@+id/editText_two”>

<requestFocus />
</EditText>

<EditText
android:id=“@+id/editTexttwo”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”/>

<EditText
android:id=“@+id/editTextthree”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”/>

<EditText
android:id=“@+id/editTextfour”
android:layout_width=“@dimen/dm_40sp”
android:layout_height=“@dimen/dm_42sp”
android:inputType=“numberPassword”
android:maxLength=“1”/>

</LinearLayout>

<Button
android:layout_width=“match_parent”
android:layout_height=“@dimen/dm_42sp”
android:layout_below=“@+id/layout_otp”
android:text=“SUBMIT” />

ii) In Activity

First create Custom_DialogBox.java class and write the code below

File : Custom_DialogBox.java

First  use changedListener in  onCreate  method:

 editText_one.addTextChangedListener(this);
editText_two.addTextChangedListener(this);
editText_three.addTextChangedListener(this);
editText_four.addTextChangedListener(this); 

And final class of  “Custom_DialogBox.java ”  :-

public class Custom_dialogbox extends Dialog implements TextWatcher

 And then Create automatically override method for TextWatcher. 

@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {}

To enter only one value to edit Text and cursor move on next edit Text automatically and when we want to remove password one by one sequencially in which cursor move back automatically,to write the cobe below on this method: 

@Override
public void afterTextChanged(Editable editable) {if (editable.length() == 1) {
if (editText_one.length() == 1) {
editText_two.requestFocus();
}

if (editText_two.length() == 1) {
editText_three.requestFocus();
}
if (editText_three.length() == 1) {
editText_four.requestFocus();
}
} else if (editable.length() == 0) {
if (editText_four.length() == 0) {
editText_three.requestFocus();
}
if (editText_three.length() == 0) {
editText_two.requestFocus();
}
if (editText_two.length() == 0) {
editText_one.requestFocus();
}
}

 After you add this Custom_DialogBox.java class in your MainActivity.java

Custom_DialogBox custom_dialog = new Custom_DialogBox(this);
custom_dialog.show();

 Follow the above steps and see a custom-dialog-box accurately.

Read More Steps To Create a Custom-Dialog-Box to Enter Four Digit OTP Number in Android

Android