Skip to main content

Posts

Android Recycler View Tutorial : Part 2



In part 1 we created recycler view without any model or view holder. In this part we will create data model and a view holder and bind both these to the recycler view.

Previous part : http://www.androidlearner.com/2017/07/android-recycler-view-tutorial.html



Now lets first create a simple data model: DummyModel.java
This class does nothing special it just generate some dummy data.


publicclassDummyModel{//text String textData ="not set yet !!";publicDummyModel(){}/** * constructor to set the dummy text * @param data */publicDummyModel(String data){ textData = data;}staticpublic List<DummyModel>getDummyModel(int length){ List<DummyModel> dummyModelsList =new ArrayList<>();for(int i =0; i < length; i++){ dummyModelsList.add(new DummyModel("This is the model "+i));}return dummyModelsList;}/** * just a setter method !Not used! * @param text */publicvoidsetText(String text){this.textDa…
Recent posts

React Native

React Native : this is the thing which I have been looking for. I want to create my app fast. At first I use rhino with android to keep my app flexible.
However React Native does all this for you, If you haven't heard about react native it is the open source framework for creating app and deploy to multiple platform.
It is more than hybrid apps because it don't use web view it uses bridge to render native component.

Even getting started is very easy no need for android studio.
I am writing this post for windows platform.

#1 first Download the nodejs , Download the latest nodejs , Install it.

#2 open cmd and type node to ensure all thing is running fine.

#3 Now during writing of this post React Native don't work fine with npm5 so you need to downgrade it to npm4 ,

#4 So run cmd and type 'npm install -g npm@4' this will install npm 4

# now lets start with react native app.

# in cmd run


npm install -g create-react-native-app create-react-native-app AwesomeProject cd …

Android Recycler View Tutorial


In Android there is the need when you need to display a list of data or simply data that get generated at run-time. Rather than creating your own layout inflator. Android provide Recycler View, there is also a listview which was provided to show data.

After after many experiments with Recycler View here is the tutorial for it. Hope it will be use full to someone.I assume if you are reading this then you know how to add activity in the android studio.

I have divided the article into several parts. Here is the First part.

Part 2 : http://www.androidlearner.com/2017/11/android-recycler-view-tutorial-part-2.html

Here is the video of it :




# First Create an Android Project. #Compiling the required library Open your build.gradle file for (module:app) level
add line compile 'com.android.support:recyclerview-v7:25.3.1' in the dependencies section.
this will download recycler view dependencies in the project.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15dependencies{compilefile…

Android Hello world Application

Android Hello World Application .

Test video.


Android Parsing JSON



When developing application at some of time you need to communicate with web service for data exchange. If your communication uses JOSN(JavaScript Object Notation) for data transfer. You may start finding the easiest library available for the JSON however there are plenty of library for JSON library for JAVA.
The one which I found suitable for my need is :
JSON-java License : MIT
Author : Sean Leary

In this article I will share how to parse JSON using JSON-java in android however the snippet is not limited to android only Getting Started
1. Download the library from : https://github.com/stleary/JSON-java
    download the source as ZIP from the github

2. Extract the Files from the zip
3. Open Android-Studio
4. Right click the Java folder navigate to New->Package

5. Select the destination directory as main\java , click on OK button

6. Enter package name as org.json and click on OK button

7. Now copy all the JSON-java .java from the source folder and copy them to Android-Studio

Android Studio Tips/Tricks

This post simple contain the android studio tricks which I used.

#1 Case insensitive code completion. This is the which I first enable on  the android studio. If you don't remember commands like me than it is for you, by enabling this you can get the required method or anything if you know part of it.

a.Open Setting from File-> settings
b. Go to code completion and set case sensitive to none c. Now all set you can check the code completion just type and press ctrl+space

#2 Find methods which can be override and implemented. I always want to know which are the methods provided by the base class that can be overridden. To find the methods which can be overridden in android studio.
Just press CTRL+O Now you have all the methods that can be overridden.
#3 Speed up android studio  If android studio lags in your system. I mean only to the GUI. below is the trick which worked for me. Go to settings -> appearance and set theme to windows and disable the animation. (this will give you…

Android How to integrate Admob

In this post I will be describe how can one integrate admob into their application.

For integrating admob you can integrate it as standalone or with firebase.

In this post I will be describing how can you integrate it as standalone.

Things required to display the admob.
1. Your app probably  android (using android studio)
2.  Admob account
3. Your app has permission to access internet.