Interface can not be converted to activity

I have created a separate class for the background process. In that, I have two classes and an interface. I am getting string data from the first class and then based on that data I am getting a list of data in another class. The whole process is wor

Toolbar menu options do not appear in fragments

I'm inflating a menu with menu items in Activity's toolbar and overwriting the options in fragment.But the new menu items are not showing up. Activity @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to t

Refresh fragments after returning an activity

I'm working on an activity which uses a TabLayout to house two fragments. Each of the fragments uses RecyclerView. The activity also has an options menu. When any of the options is clicked, a new activity will start. One of the new activities has a "

Why does the ListView object return a null value each time?

I tried to fill a ListView with data, but the app crashes every time. The ListView returns null all the time . Here is my Fragment code @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { list

Error Inflating class fragment in xml activity cards

This project used to be working before. When running the app, I keep getting InflateException. 04-01 12:16:36.102 14895-14895/com.example.ali.googleandroid E/AndroidRuntime: Process: com.example.ali.googleandroid, PID: 14895 04-01 12:16:36.102 14895-

in tab layout fragments not showing their layout

I have a tablayout in which I have included five fragments, but when I go to any other tab, the fragments XML (layout) is not showed, instead a black screen appears only. I am including my tab activity code and the screenshot of the app and for refer

Accessing the MainFragments Web View in Another Fragment

My application has a main fragment which has a webview in it, the webview serves different local html files, that the user selects from other fragments listview. I have implemented the onclick listener on the list view but when I try to populate the

How to hide action items in the toolbar

I have replaced the Actionbar with Toolbar. My minSDK-17 and TargetSDK-21. So here is the issue. I have 2 activities and 4 action items. A B C D All the 4 action items are maintained in toolbar_actions.xml Currently all the 4 action items are display

Strange logcat error when switching to a new fragment

I haven't encountered a stack trace such as this. It's particularly weird because I can only get the error to be thrown when debugging. (Running the app without debugging does not yield this error). This happens upon selecting a particular page from

Android Display Fragment on the Activity Bar

Fragment shows below Activity Actionbar, I want to show Fragment Over Activity Actionbar My Requirement Activity that have Fragment On Menu OverFlow I show Fragment I want to Show Show Fragment Over Activity Action bar, see Image bellow use Sliding m

Pass the identifier or the whole object between activities?

I have an activity containing a ListFragment. It's populated from a restful webservice. When I click on an item in the list I send back the id of that item to my activity. And using an intent pass that on to a second detail activity and request the o

Android replaces a fragment with an activity in a framelayout

I have a navigation drawer project with some fragments, now I want to call an activity from the menu. The fragments are loaded into a framelayout and replaced with a new fragment on click event menu with a transaction. When I click on the menu item I

Add views to the layout?

Let's say I have an Activity that consists of a View/ViewGroup with a Button that takes up 100% of the space. Now, by pressing the Button, I would like to add a View/ViewGroup so that both items take up 50% of the screen (and so on). I thought I coul

ListView flushes after switching a fragment in fragmentHolder

I have a listview in one of my fragments and it empties when I leave that fragment. Why is it happening? That fragment: public class ListActivity extends ListFragment { public void ToastLoadShout(String msg) { Toast.makeText(getActivity(), msg.toStri

Asynctask with fragments, Shutting down VM error

I'm trying to use a AsyncTask consulting a parseobject and brings me a picture and text in a list, but when running above shows me the following error: 10-27 16:29:18.335: D/AndroidRuntime(28453): Shutting down VM 10-27 16:29:18.335: W/dalvikvm(28453

Sliding drawer with ViewPager causing blank fragments

I'm using an Activity with a Drawer Layout, which I need for switching between different Fragments. One of these Fragments is making use of a ViewPager with a FragmentStateViewPagerAdapter, which I need to use for implementing the Swipe Views behavio

It is impossible to transmit data between these two fragments

I'm going insane!! I don't manage to pass data from a fragment(A) to an another fragment(B). I read about using a public interface... and it seems to work, but i don't understand how to use this method. Fragment(A) package it.anddev.pagertabs; public

FragmentTransaction fragments change does not work?

When the user clicks an element in a ListView in one fragment, the listener is notified through an interface and it should change the fragment next to the menu. My current code looks like this Fragment f = null; switch(fragmentId) { case 0: f = new x

Problems with setText in a fragment in onCreateView (& hellip;)

I know that people has asked similar questions but I still can't manage. I have a fragment and in the onCreateView() I have a string that I want to set equal to the text in my textView. However I can't make it work. Can somebody please give me a code

How to display a fragment containing a custom SurfaceView

This following setup does not work, does anybody know why (I cant seem to find examples of custom surface view in a fragment). My surfaceView class is just hollow at the moment: class MySurfaceView extends SurfaceView implements Runnable{ public MySu