You are on page 1of 3

What does Density-Independent Pixel (dp) actually mean?

You might be familiar with a pixel,


which is a small illuminated area on a screen. Screens are essentially made up of hundreds of
thousands of these pixels.

So what is a "density independent" pixel? Well, better screens will often have more pixels in the
same amount of space. The number of pixels in a fixed space is known as the screen's pixel
density. In case you're wondering, 48dp translates to approximately 9mm in physical size.

Hard Coding providing fixed size for view.

wrap-content

Scale - Independent Pixels (sp) like dp makes the app look consistent on different sized devices
but used for text only.

Material Design Spec some specified attributes for changing desgins using xml

XML extensible markup language

android:scaleType it tells the device how to scale up or scale down the image based on the
bounds of the ImageView. can be center, centercrop

layout_wight to set the buttons equally spaced

Context the context will help the intent to know more about the current state of the app so, that
we can put the second activity in front of the current activity (in terms of intent)

Abstract Method not implemented i.e are created but left unimplemented so that you can
implement on your own

Abstract Class partically implemented have some implemented methods and not implemented
uses keyword extends

Interface have abstract methods and no states uses keyword implements

Array v/s ArrayList arraylist is more flexible than array, we can it doesn't have to be of fixed
length, it can increase and decrease in length anytime but we can't store primitive data types in
arraylist that's why insted of int we will be storing Integer values, as Integer is a wrapper class of
int which converts int to an Integer object. array doesn't have methods that can be modified
but arraylist is a class that's why it has methods that can be modified

onClickListener performs anything when it it listens for an event onClick performs anything
when something event has occured

E (Element) generic object when implementing we can replace E with a particular non primitive
datatype, individual parts of a collection is called an element

Recycling View using same view and just changing info

Instead of using Arraylist or so many textviews we can use ListView + ArrayAdapter we just have
to change the data and use same view not so many views for every data, because the data which
is not visible on screen can adjust on the views visible on screen.

We have to put not currently being used views on scrap views which is a bunch of view that are
not currently being shown on the screen right now we will use them if when we need them so
that memory doesn't get overwhelmed because of all the views beign shown on screen at the
same time.

create more views on demand from scrap pile

tools namespace tools namespace was created by Android's tools team and has bunch of
attributes that can help you out with writing yours layouts. We will be using its Designtime
arrtributes which helps us when we are developing our code but won't actually show up at
runtime

getView(int position, View convertView, ViewGroup parent) convertView is the view to be


recycled, it can be null(means we don't have any view to recycle), if it is null than we will inflate
new view from xml layout file. LayoutInflater will turn the xml layout file into actual view objects.

density dpi (dots per inch)

1dp = 1px (mdpi) 1dp = 1.5px(hdpi) 1dp = 2px(xhdpi) 1dp = 3px (xxhdpi) 1dp = 4px(xxxhdpi)

final keyword makes the variable constant so that it doen't get modified later in the code and
the variable name must be capital which shows it is declared final

static it shows that the variable is associated with class not associated with an object instance of
the class . Since the VISIBLE keyword is public and static you go ahead and refer to this variable
directly

static method you can call static method using exact same name of the class as

MediaPlayer.create(context, R.raw.song)

but you can call non static method by using object instance of that class as

mediaPlayer.start();

static methods are bound to the class itself so calling them you don't need to create the object
instance of the class.

AdapterView types of adapterViews are listView, spinner, gridViews


Application Programming Interface API It's how a software product or service makes certain
parts of it's functionality or data available to use in other software.

JSON JavaScript Object Notation is pretty good format for working with API data and GeoJSON
is special type of JSON that is tailored just for describing geographical information. It is set of
some tactical rules to organize data and thus is completely programming language independent

Unix timestamp the number of seconds since the date january 1st, 1970

Parsing Transforming a string of JSON into a live JSON object or JSON array requires parsing. It
basically means that the computer reads some text written in a language it knows, and then
transforms it in another more usefull representation like a JSON object that we can call methods
on, and then extract the data that we need from it.

JSON opt(optional) methods can be used instead of getter methods so that if the value doesn't
exist it will return null, it won't throw JSON Exeption.

You might also like