should I use fragment or viewpager for my application

Demo1 Demo2 when users click the button to answer the questions for the TextView on the top, the TextView will change the questions depends on the user's answer. (I think this part won't be hard for me) But what should I do after user click the butto

Pass listview data in a fragment to a fragment

when i click on the listview the bundle can get the value, but cant pass the value to second fragment. First Fragment categorylist.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent

DatePicker does not work when I used Fragment

i set DatePicker it is working in Activity when i used Fragment it generating the errors like Error:(63, 61) error: incompatible types: MainActivity cannot be converted to Context Here i paste the complete code. MainActivity.Java package com.example.

Recyclerview in the fragment using json flight data?

please any one explain RecyclerView in fragment using volley to get json data. Already i refered below link coding Google recyclerview in fragment this is my first project in android, so i cannot understand that coding. Please any one help me. My fra

DialogFragment provoking ANR

I'm having some weird issues with DialogFragment on a real Device. Samsung Galaxy Note 4. When I try to open an dialog, the application enters an infinte loop (something from the system) and it gives ANR after a while. Everything is blocked. There ar

NullPointerException in OnCreateView of Fragment ()

This question already has an answer here: fragment.onCreateView causes null pointer exception 3 answers I get a NullPointerException at Fragement's OnCreateView() methods. I've tried several things, but the error keeps showing up. I think the error c

Drag / Drop feature in Android studio does not work

I'm new to android programming The drag/ and drop feature in android studio is not working. I can't drag anything to my phone. Right now my fragment is google map view and i want to add a search bar to the view. It just doesn't drag. When I try to ad

Fragment change by clicking on Imageview

I create a project with the NavigationDrawerFragment, and I set the fragments for the menu. Switching between menus fragments are working. But now I create an imageview on one of the fragments. and I want that when you click on the imageview it chang

Android dynamic spinner in fragment

i need help. I looked in other posts and try to do same but all solutions isn't working. I'm trying to make spinner with dynamic data, but always stop working... @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle

Fragment replace do not work until the second time

Hey ,everybody,what a nice day! I am making an App which have a RadioGroup(Customed) in the bottom of screen.And when first enter into the App,it will show you the welcome fragment like below:(sorry,I can't upload pictureT^T,though I know I can post

Show the fragment as a popup with a transparent background

I would like to make a Fragment pop-up like an AlertDialog but with a transparent background. My fragment looks like this: At the moment I am doing the following: @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l

Asynchronous Update ListFragment

I've checked other answers regarding the asynchronous updates of ListFragments and have figured out that the most common problem for the notifyDataSetChanged() method not working is, that developers tend to overwrite the initial adapter source, causi

android - opening a map causes the application to crash

I've an app that opens a map when I click on a image. i made some changes to the layout of the activity and the map stopped to work. I've no idea of what is the error, I haven't changed the map class and the manifest should be ok too. here's my setOn

Fragment addToBackStack Closure App

I didnt find any solution for my problem. I got several Fragments (dynamically created), but my Back Button is not working at all, pressing it will close the App, whatever fragment is "active". @Override public boolean onOptionsItemSelected(Menu

How to cache some code in php?

This question already has an answer here: Caching variables in PHP 4 answers Does PHP has a built in fragment caching mechanism to server side cache code parts? For example, I have a page that queries the database 15x times. Most times the results wi

Can not Start Fragment Bundle When Using JSP with OSGi

So, I am trying to use JSP and JSTL to build the UI to work with OSGi environment. I've added the required bundle for the JSTL to work: - com.springsource.javax.servlet.jsp.jstl_1.2.0.v20110728 I have also added all the required bundle in the environ

Android ViewPager exception after pressing the back button

I have a ViewPager which contains 3 fragments which is working fine. I start an activity from my any of my fragments inside the viewpager and the activity is displayed. After that when i press the back button, my application crashes with the followin

ClassCastException when declaring a fragment in XML

I declared a Fragment in a layout then try to inflate that view but I always get the ClassCastException. Please help me to solve this. This is my layout source: <RelativeLayout xmlns:android="" style=

Android fragments overlap after screen rotation

This app is a learning exercise for me using fragments, among other things. It has a single activity that manages some different fragments. The first is a ListFragment (A), which shows when the app starts and loads list items from a cursor. Clicking