Android Development Archives | Programming Guide

How to implement a simple Ad to activity with a simple design

STEP1: Create google AdMob Account on get your publisher id  it looks like this: ca-app-pub-12345678912345667778901123 (SAMPLE)NEVER USE your pub id for test purpopeses!your account may be banned !!!!For test purposes use a test pub id: STEP2: Create new Empty Activity and add to strings.xml <string name = “google_app_id” translatable=”false”>ca-app-pub-3940256099942544/6300978111</string> (test sample)  STEP3: ADD to manifest following parameters: Dont […]

Android Studio release 3.5 features

Google has released new version of Android Studio 3.5 for development.There are major improvements containing perfomance,memory allocation and synchronizations.Feature 1: Memory usage report Memory problems may be reported to google helping analyze the main source of problems.Feature 2: Windows: Antivirus file I/O optimization Automation process of excluding project from antivirus scanner. This improves slightly perfomance. Feature 3:Project Marble […]

how to get data from a weather server Part 1.

In this tutorial we access a weather data from a following Server: 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 ‘’ Now we need to set up a Network based HTTP client.In this example we use a JSON object example from a […]

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 […]

How to write a file in Android

First, we need to define a path. We can’t save files everywhere because of the different permissions. We write our file to the project path. Create Empty Project  Start emulator or your device Go to View ->Tool Windows->Device File Explorer Select directory Data->Data  6.Select your project folder and copy path(right mouse click) My path is /data/data/learn.hq.readwritefiles/textFile.txt Well, this […]

Android Custom ViewList with onItemClickListener

Android Custom ViewList with onItemClickListener If you want to create a custom List you have to implement BaseAdapter (Observable pattern) making modifications with a help of getView() method  . BaseAdapter is a common based class providing an Adapter an implemantation.Generally you use it in Listview and SpinnerAdapter.The most important method is notifyDataSetChanged().The method refresh the modifications of the […]