Skip to main content

Posts

Showing posts from November, 2019

How to Add VideoView in android

In activity_main.xml add these lines of codes:- <? xml version ="1.0" encoding ="utf-8" ?> < RelativeLayout 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 :orientation ="vertical" android :layout_height ="match_parent" tools :context =".MainActivity" > < VideoView android :layout_alignParentTop ="true" android :layout_alignParentBottom ="true" android :layout_alignParentLeft ="true" android :layout_alignParentRight ="true" android :id ="@+id/simpleVideoView" android :layout_width ="fill_parent" android :layout_height ="fill_parent" /> </ RelativeLayout ...

Room + ViewModel + LiveData + RecyclerView (MVVM)

Part 1 - Introduction Part 2 – Entity Part 3 – DAO & RoomDatabase Part 4 – Repository Part 5 – ViewModel Part 6 – RecyclerView + Adapter Part 7 – Add Note Activity Part 8 – Swipe to Delete Part 9 – OnItemClickListener & Update Functionality Part 10 – ListAdapter                     Part 1 - Introduction In this tutorial we will build a note taking app, using the Android Architecture Component libraries (Room, ViewModel, LiveData and LifeCycle), a RecyclerView and Java. The data will be stored in an SQLite database and supports insert, read, update and delete operations. For this we will follow the official recommendations from the “Guide to App Architecture” (link below). In part 1 we will learn what the Architecture Components are, how they work and why we need them. We will learn about the problems that arise from the Activity and Fragment lifecycle, configuration changes and bloated, tightly coupled cl...

Update UI Every New Minute

In this tutorial, we will learn how you can update the user interface whenver the system minute changes, using a BroadcastReceiver in Android Studio. You can use this, if you want to do something once per minute, exactly when the seconds reach 60. In MainActivity.java class file write these lines of codes:- import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.TextView; public class MainActivity extends AppCompatActivity {     private TextView counterText;     private BroadcastReceiver minuteUpdateReceiver;     private int counter;     @Override     protected void onCreate(Bundle savedInstanceState) {         super.onCreate(savedInstanceState);         setConte...

How I Started to Learn Android Programming

A lot of people don’t really know how to start learning programming. They don’t know if they should read books, watch Youtube videos or buy online courses for money and they often seem to get stuck. Now, people have different learning styles and what works for me obviously won’t work for everyone, but I will also try to take general recommendations, that I read often, into consideration in this post. So this is what I did as a complete beginner, and what I would do again if I had to start over: 1.  Read a good beginner book for the basics (or buy a beginner course) Books are not dynamic, not interactive and they get outdated, whereas on the internet you can find up to date results to specific questions if you search properly. But when you know absolutely nothing about programming, I think it’s a good idea to pick a beginner book with good ratings and read it through. That’s what I did. But I did NOT do all the exercises in there, if I felt like they slow me down or...

Razorpay Payment gateway integration in android application.

         Razorpay payment gateway requires less time and minimum code. Creating New Project: 1. In Android Studio, create a new project by navigating to File ⇒ New Project and fill all the required details. When it prompts to select a default activity, select Blank Activity and proceed. Notes:- Minsdk should be equal to or greater than 19 2. Open build.gradle and add razorpay support by adding compile 'com.razorpay:checkout:1.2.0' under dependencies section. dependencies  { implementation ' com.razorpay:checkout:1.5.8 ' } 3. Now open AndroidManifest.xml and add this singleton class in <application> tag using android:name property to execute the class automatically whenever app launches. Also add INTERNET permission as we are going to make network calls. You need to add your Razorpay API key to AndroidManifest.xml. You also need to add the RECEIVE_SMS permission. <?xml version="1.0" encoding="utf-8"?> ...