July 2019 | Programming Guide

how to get data from a weather server Part 1.

In this tutorial we access a weather data from a following Server: https://home.openweathermap.org The first step is to to allow internet permission in Android manifest file. <uses-permission android:name=”android.permission.INTERNET” /> Second add in build.gradle(Module:app) following dependency: implementation ‘com.android.volley:volley:1.1.1’ Now we need to set up a Network based HTTP client.In this example we use a JSON object example from a […]

try-catch block

a try catch block prevents to crash the application to occur and intercept the Exceptions while runtime . Syntax:  try{ // code catch([Exceptionclass ex]){ // error handling } But what is a Exception?Exception is an event , which collides  serious unforseen problem.Exception class is a subclass of Throwable. Exception Hierarchy A typical IndexOutofBoundExceptions occurs when you access the […]

How to use reflections in java

Reflections provide you access to other classes,methods and constructors from a loaded class.Manipulating methods,Fields,Constructors is possible through invoking different operations. Reflections are often used in RPC(Remote Procedure Call) providing remote access to Constructors and Fields. The main disadvantages using reflections are: No compile Time checking Performing complex access low Perfomance Advantages: knowing compile time is not needed modify […]

How to create Second Activity bypassing a value with Android Studio

  btn.setTag(data) – We bypass our value into a memory of Viewholder pattern and get the value from our OnClickListener of View. Intent i = new Intent(MainActivity.this,Main2Activity.class); Every app could have many Activities. To invoke other Activity we use Intent class to send a value to a BroadCastReceiver. i.putExtra(“T”,data); Bypass our variable to another Intent.   We create […]