Foydalanilgan Adabiyotlar
https://developer.android.com
https://developer.android.com/docs
https://about.gitlab.com
https://www.linkedin.com
https://sites.google.com/site/mxvpen/api
Ilova
package com.example.newsapp
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.newsapp.adapters.HomeAdapter
import com.example.newsapp.models.*
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity(), HomeAdapter.OnItemClickListener {
private var data: ArrayList = ArrayList()
private var adapter: HomeAdapter = HomeAdapter(this)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
loadData()
adapter.setList(data)
home_list.adapter = adapter
home_list.layoutManager = LinearLayoutManager(this)
adapter.setItemClickListener(this)
}
private fun loadData() {
loadCategory()
loadSliderData()
loadNewsData()
}
private fun loadNewsData() {
var news = ArrayList()
news.add(
NewsData(
R.drawable.news1,
Do'stlaringiz bilan baham: |