How to Create News App Android Studio | Source code free

Create News Application Android Studio – Here i will show how to create android news application in android studio. There are more popular news channel will be there but here you can also develop the updated & Create news app in your android platform using API key.

I have used New York Times API key to get latest news updates, it’s regularly update all topic like social, sports, entertainment news and more. So you have just get the API key and insert from our android news application project. After that the API key automatically fetch all news and show from android application feed.

Create News Application Android Studio

<img decoding=

Let’s start to develop android news application. First very important to get API key from New York Times websites. So in below i give link for how to get API key for your project create news app. Open the link and just register your account via enter email. After that they send API key from your registered email-id. Copy the API key and paste from your project (build.gradle file).

Get API key

Link for API website-
Click here to Get NYT API Key – New York Times APIs. Just fill that details in the link they ask your Name and Email-id after fill the SignUP form you get API key.

Create News App
As usual File=>create news app project and choose Empty Activity, after creating the project open the default class of file and add the following below code,

package com.dude.newsapp;

import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;

public class MainActivity extends AppCompatActivity {

    String API_KEY = "8190df9eb51445228e397e4185311a66"; // ### YOUE NEWS API HERE ###
    String NEWS_SOURCE = "techcrunch"; // Other news source code at:
    ListView listNews;
    ProgressBar loader;

    ArrayList<HashMap<String, String>> dataList = new ArrayList<>();
    static final String KEY_AUTHOR = "author";
    static final String KEY_TITLE = "title";
    static final String KEY_DESCRIPTION = "description";
    static final String KEY_URL = "url";
    static final String KEY_URLTOIMAGE = "urlToImage";
    static final String KEY_PUBLISHEDAT = "publishedAt";

    protected void onCreate(Bundle savedInstanceState) {

        listNews = findViewById(;
        loader = findViewById(;

        if (Function.isNetworkAvailable(getApplicationContext())) {
            DownloadNews newsTask = new DownloadNews();
        } else {
            Toast.makeText(getApplicationContext(), "No Internet Connection", Toast.LENGTH_LONG).show();


    class DownloadNews extends AsyncTask<String, Void, String> {
        protected void onPreExecute() { super.onPreExecute(); }

        protected String doInBackground(String... args) {
            String xml = Function.excuteGet("" + NEWS_SOURCE + "&sortBy=top&apiKey=" + API_KEY);
            return xml;

        protected void onPostExecute(String xml) {

            if (xml.length() > 10) { // Just checking if not empty

                try {
                    JSONObject jsonResponse = new JSONObject(xml);
                    JSONArray jsonArray = jsonResponse.optJSONArray("articles");

                    for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject jsonObject = jsonArray.getJSONObject(i);
                        HashMap<String, String> map = new HashMap<>();
                        map.put(KEY_AUTHOR, jsonObject.optString(KEY_AUTHOR));
                        map.put(KEY_TITLE, jsonObject.optString(KEY_TITLE));
                        map.put(KEY_DESCRIPTION, jsonObject.optString(KEY_DESCRIPTION));
                        map.put(KEY_URL, jsonObject.optString(KEY_URL));
                        map.put(KEY_URLTOIMAGE, jsonObject.optString(KEY_URLTOIMAGE));
                        map.put(KEY_PUBLISHEDAT, jsonObject.optString(KEY_PUBLISHEDAT));
                } catch (JSONException e) {
                    Toast.makeText(getApplicationContext(), "Unexpected error", Toast.LENGTH_SHORT).show();

                ListNewsAdapter adapter = new ListNewsAdapter(MainActivity.this, dataList);

                listNews.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                    public void onItemClick(AdapterView<?> parent, View view,
                                            int position, long id) {
                        Intent i = new Intent(MainActivity.this, DetailsActivity.class);
                        i.putExtra("url", dataList.get(+position).get(KEY_URL));

            } else {
                Toast.makeText(getApplicationContext(), "No news found", Toast.LENGTH_SHORT).show();


package com.dude.newsapp;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

//import com.squareup.picasso.Picasso;

import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.HashMap;

class ListNewsAdapter extends BaseAdapter {
    private Activity activity;
    private ArrayList<HashMap<String, String>> data;

    public ListNewsAdapter(Activity a, ArrayList<HashMap<String, String>> d) {
        activity = a;
    public int getCount() {
        return data.size();
    public Object getItem(int position) {
        return position;
    public long getItemId(int position) {
        return position;
    public View getView(int position, View convertView, ViewGroup parent) {
        ListNewsViewHolder holder = null;
        if (convertView == null) {
            holder = new ListNewsViewHolder();
            convertView = LayoutInflater.from(activity).inflate(
                    R.layout.list_row, parent, false);
            holder.galleryImage = (ImageView) convertView.findViewById(;
   = (TextView) convertView.findViewById(;
            holder.title = (TextView) convertView.findViewById(;
            holder.sdetails = (TextView) convertView.findViewById(;
            holder.time = (TextView) convertView.findViewById(;
        } else {
            holder = (ListNewsViewHolder) convertView.getTag();

        HashMap<String, String> song = new HashMap<String, String>();
        song = data.get(position);


            if(song.get(MainActivity.KEY_URLTOIMAGE).toString().length() < 5)
                        .resize(300, 200)
        }catch(Exception e) {}
        return convertView;

class ListNewsViewHolder {
    ImageView galleryImage;
    TextView author, title, sdetails, time;

NOTE- Remaining all code are given in Source code click and download below

In this project we need to create more java classes and XML files to create perfect android create news app in android studio. So here finally i give the full source code of this project because not enough space to explain all java classes in this article.

Make browser app click here.

ADD Dependency on gradle file

 implementation 'com.squareup.picasso:picasso:2.71828'

apply plugin: ''

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.dude.newsapp"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), ''

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'com.squareup.picasso:picasso:2.71828'

Activity Layouts
Need to integrate XML files into java clsses to make android news application. Open under the path of res =>layout =>activity_main.xml file and add the following code,

YouTube Video

Download Source Code

Click below to get the source code android news application.

Download News Apk: CLICK ME

Download News Logo: CLICK ME

Click below to get the full source code android news application.


We have successfully created a News App Android application using Android Studio.



Leave a Comment

Your email address will not be published. Required fields are marked *