This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.util.Base64; | |
| import androidx.annotation.NonNull; | |
| import androidx.annotation.Nullable; | |
| import java.nio.charset.StandardCharsets; | |
| import java.security.MessageDigest; | |
| import java.util.Arrays; | |
| import javax.crypto.Cipher; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Add below files in Gradle | |
| compile 'com.squareup.retrofit2:retrofit:2.3.0' | |
| compile 'com.squareup.retrofit2:converter-gson:2.3.0' | |
| compile 'com.squareup.okhttp3:logging-interceptor:3.6.0' | |
| Create Api Client | |
| public class ApiClient { | |
| private static Retrofit retrofit = null; | |
| private static final String CACHE_CONTROL = "Cache-Control"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String URL="https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCN2W5ND2GDEqw4NSauNmbRw&maxResults=25&key=API KEY PASTE HERE&type=video"; | |
| StringRequest stringRequest=new StringRequest(Request.Method.GET, URL, new Response.Listener<String>() { | |
| @Override | |
| public void onResponse(String response) { | |
| try { | |
| JSONObject jsonObject=new JSONObject(response); | |
| JSONArray jsonArray=jsonObject.getJSONArray("items"); | |
| for(int i=0;i<jsonArray.length();i++){ | |
| JSONObject jsonObject1 = jsonArray.getJSONObject(i); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example; | |
| import android.app.Activity; | |
| import android.graphics.Typeface; | |
| import android.support.v7.widget.RecyclerView; | |
| import android.util.Log; | |
| import android.view.LayoutInflater; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| import android.widget.ImageView; | |
| import android.widget.TextView; |