Skip to main content

Posts

Showing posts from February, 2018

Featured post

Simple RecyclerView example with filter option in Android

Hi Guys, Maybe you all are expert in terms of using RecyclerView in android. This blog is simple example for using filter option with RecyclerView adapter. As for now you will instantiate RecyclerView and set the adapter to RecyclerView as following way. RecyclerView list = (RecyclerView) findViewById(R.id.list); list.setLayoutManager(new LinearLayoutManager(this)); list.setHasFixedSize(true); ArrayList&ltNumber&gt numbers = new ArrayList&lt&gt(); String ONEs[] = {"ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "TEN"}; String TENs[] = {"ZERO", "TEN", "TWENTY", "THIRTY", "FOURTY", "FIFTY", "SIXTY", "SEVENTY", "EIGHTY", "NINETY", "HUNDRED"}; String HUNDREDS[] = {"ZERO", "HUNDRED", "TWO HUND

Simple example of using RadioGroup, RadioButton in Kotlin | Android

Here is the simple example of using RadioGroup, RadioButton in Android Kotlin. &ltRadioGroup xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/radioGroup" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.guna.kotlinapplication.BlankFragment"&gt &ltRadioButton android:id="@+id/radioMale" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/male" /&gt &ltRadioButton android:id="@+id/radioFemale" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/female" /&gt &lt/RadioGroup&gt OnCheckedChangeListener radioGroup.setOnChe

Simple example of using Fragments in Kotlin | Android

Here is the simple example of using Fragments with Activity in Android. MainActivity.kt class MainActivity : AppCompatActivity(), BlankFragment.OnFragmentInteractionListener { override fun onFragmentInteraction(uri: Uri) { TODO("not implemented") //To change body of created functions use File | Settings | File Templates. } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) setSupportActionBar(toolbar) if (savedInstanceState == null) { supportFragmentManager.beginTransaction(). add(R.id.fragment, BlankFragment.newInstance("Param1", "Param2"), "Second").commit() } fab.setOnClickListener { view -> //Here we will replace the BlanckFragment with SecondFragment. supportFragmentManager.beginTransaction().replace(R.id.fragment, SecondFragment(),