Can any one help with the solution here i am getting the ERROR that
E/RecyclerView: No adapter attached; skipping layout
here are my files.
OneFragment.
You need to return drawer;
instead of inflater.inflate(R.layout.fragment_one, container, false);
inside onCreateView()
EDIT
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View drawer = inflater.inflate(R.layout.fragment_one, container, false);
feedsList = new ArrayList<FeedItem>();
mRecyclerView = (RecyclerView) drawer.findViewById(R.id.recycler_view);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
progressBar = (ProgressBar) drawer.findViewById(R.id.progress_bar);
String url = "http://krishscs.esy.es/RecycleViewExample/RecycleViewExample.php";
mSearchView = (SearchView) drawer.findViewById(R.id.search_view);
setupSearchView();
new DownloadTask().execute(url);
adapter = new MyRecyclerViewAdapter(getActivity(),feedsList);
Toast.makeText(getActivity(), "HELLO", Toast.LENGTH_SHORT).show();
mRecyclerView.setAdapter(adapter);
// Inflate the layout for this fragment
return drawer;
}
Try this
private void parseResult(String result) {
try {
feedsList = new ArrayList<FeedItem>();
JSONObject response = new JSONObject(result);
JSONArray posts = response.optJSONArray("result");
for (int i = 0; i < posts.length(); i++) {
JSONObject post = posts.optJSONObject(i);
FeedItem item = new FeedItem();
item.setTitle(post.optString("name"));
item.setThumbnail(post.optString("image"));
feedsList.add(item);
}
adapter = new MyRecyclerViewAdapter(getActivity(),feedsList);
mRecyclerView.setAdapter(adapter);
Log.d("POSTDATA",feedsList.toString() );
} catch (JSONException e) {
e.printStackTrace();
}
}