This file contains 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.coderefer.rxandroidexamples.intro; | |
import android.support.v7.app.AppCompatActivity; | |
import android.os.Bundle; | |
import android.view.View; | |
import android.widget.Toast; | |
import com.coderefer.rxandroidexamples.R; |
This file contains 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
BufferedReader reader = null; | |
try { | |
reader = new BufferedReader( | |
new InputStreamReader(getAssets().open("news_data_file.json"), "UTF-8")); | |
// do reading, usually loop until end of file reading | |
String mLine; | |
while ((mLine = reader.readLine()) != null) { | |
//process line | |
... |
This file contains 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
try { | |
val inputStream:InputStream = assets.open("news_data_file.json") | |
val inputStreamReader = InputStreamReader(inputStream) | |
val sb = StringBuilder() | |
var line: String? | |
val br = BufferedReader(inputStreamReader) | |
line = br.readLine() | |
while (br.readLine() != null) { | |
sb.append(line) | |
line = br.readLine() |
This file contains 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
try { | |
val inputStream:InputStream = assets.open("news_data_file.json") | |
val inputString = inputStream.bufferedReader().use{it.readText()} | |
Log.d(TAG,inputString) | |
} catch (e:Exception){ | |
Log.d(TAG, e.toString()) | |
} |
This file contains 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
dataBinding { | |
enabled = false | |
} |
This file contains 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
dependencies { | |
... | |
//adding a recyclerview | |
compile "com.android.support:recyclerview-v7:26.1.0" | |
//adding a cardview | |
compile "com.android.support:cardview-v7:26.1.0" | |
... | |
} |
This file contains 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
... | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/recyclerView" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:scrollbars="vertical"/> | |
... |
This file contains 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
<?xml version="1.0" encoding="utf-8"?> | |
<layout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
tools:context="com.coderefer.newsboard.MainActivity" | |
> | |
<android.support.v7.widget.CardView | |
android:layout_width="match_parent" |
This file contains 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.coderefer.newsboard | |
import android.support.v7.widget.RecyclerView | |
import android.util.Log | |
import android.view.View | |
import android.view.ViewGroup | |
import com.squareup.picasso.Picasso | |
import kotlinx.android.synthetic.main.news_item.view.* | |
/** |
This file contains 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.coderefer.newsboard | |
import android.databinding.DataBindingUtil | |
import android.support.v7.app.AppCompatActivity | |
import android.os.Bundle | |
import android.support.v7.widget.LinearLayoutManager | |
import android.util.Log | |
import com.coderefer.newsboard.databinding.ActivityMainBinding | |
import kotlinx.android.synthetic.main.activity_main.* | |
import org.json.JSONArray |
OlderNewer