How to make a news feed like facebook for Android?
I want to make an application with something like a facebook news feed, it will be text with an image below it, which will open a new page, but I don't really know what it's called, so I can't search the web for something. what i dont know is the name, so if someone can tell me what it is called or how to make a news feed like facebook or a tutorial for this idea.
source to share
These are mainly ListView and ListAdapter.
You need to change the default ListView layout to suit your needs.
As per your requirement, in order to achieve Facebook layout you can refer to this resource link for help
http://www.androidhive.info/2014/06/android-facebook-like-custom-listview-feed-using-volley/
source to share
I'll give you an option and a first step. You can use JSON queries to find texts and images stored in a web service.
// DownloadJSON AsyncTask
private class DownloadJSON extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
// Create a progressdialog
mProgressDialog = new ProgressDialog(MainActivity.this);
// Set progressdialog title
mProgressDialog.setTitle("Your app");
// Set progressdialog message
mProgressDialog.setMessage("Loading...");
mProgressDialog.setIndeterminate(false);
// Show progressdialog
mProgressDialog.show();
}
@Override
protected Void doInBackground(Void... params) {
// Create an array
arraylist = new ArrayList<HashMap<String, String>>();
// Retrieve JSON Objects from the given URL address
jsonobject = JSONfunctions
.getJSONfromURL("YOUR_PATH_URL_CONECT.PHP");
try {
// Locate the array name in JSON
jsonarray = jsonobject.getJSONArray("value");
for (int i = 0; i < jsonarray.length(); i++) {
HashMap<String, String> map = new HashMap<String, String>();
jsonobject = jsonarray.getJSONObject(i);
// Retrive JSON Objects
map.put("thumbImage", jsonobject.getString("thumbImage"));
map.put("title", jsonobject.getString("title"));
// Set the JSON Objects into the array
arraylist.add(map);
}
} catch (JSONException e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void args) {
// Locate the listview in listview_main.xml
listview = (ListView) findViewById(R.id.listview);
// Pass the results into ListViewAdapter.java
adapter = new ListViewAdapter(MainActivity.this, arraylist);
// Set the adapter to the ListView
listview.setAdapter(adapter);
// Close the progressdialog
mProgressDialog.dismiss();
return;
}
}
YOUR_PATH_URL_CONECT.PHP
echo '{"value":'.json_encode($yourArrayJsonObject).'}';
Now create the rest of the adapters.
source to share