fragment

Android - Expandable List within Fragments

有些话、适合烂在心里 提交于 2019-12-23 04:15:09
问题 Hey, I am trying to convert my existing App using Tabhost and Activities to a Action Bar based App with fragments. In this process a ran into the issue to implement Expandable Lists. I haven´t found any simple example in the internet on how to implement this Expandable List. As ExpandableListActivity has no counterpart for fragments I think I need to use and extend ListFragment but as I am quite new to android I haven´t got any clue how. :) I would be glad if someone could shed some light on

MvvmCross: Polymorphic list within fragment based tab view

时光总嘲笑我的痴心妄想 提交于 2019-12-23 03:33:06
问题 I am trying to create a GUI which uses fragment based TabView. The code is based on the FragmentSample found in MvvmCross tutorials. The number of tabs within the TabView depends on data read from xml file and every tab uses the same fragment. So far everything workes OK. The problems started when I tried to add polymorphic list to the fragment. The code used to create polymorhpic list is basically the same as found in Collection sample(again from MvvmCross tutorials). First i tried to create

Fragment disappear after coming back from startActivityForResult

纵饮孤独 提交于 2019-12-23 01:53:02
问题 i have a strange problem. i use nested fragment in my code,( 4 level ) Home -> Services -> ServiceDetails -> Upload in the last fragment ( Upload Fragment ) i want to choose image from the gallery or the camera so i wrote the following code to pick the image : switch (which) { case galleryItem: Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult( Intent.createChooser(intent, “Select Album”, Home.GALLERY_REQUEST); break;

Fragment cannot be cast to an android.app.activity

女生的网名这么多〃 提交于 2019-12-22 23:20:53
问题 I created a very fragment to test my app and I got the following error message: 03-28 11:11:58.079: E/AndroidRuntime(11760): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.demoresponsevision/com.android.demoresponsevision.fragment.BarcodeScreen}: java.lang.ClassCastException: com.android.demoresponsevision.fragment.BarcodeScreen cannot be cast to android.app.Activity Fragment Code:- public class BarcodeScreen extends Fragment { TextView tvStatus; TextView

How do I get my ListView Class in a List Fragment from SQLite?

怎甘沉沦 提交于 2019-12-22 18:28:10
问题 I have gone through several tutorials on fragments and I can't get my queries to display in a List Fragment. Below are my original classes that need converting for use in a fragment activity. My QueryDisplay class has so much in it, I don't know what to remove from it and where to put it to get it working. Mainly, I don't know how to call my ListView Class in the below Fragment Activity. Thank-Your for your help in advance. Code would be very helpful too!! Here is the ListActivity that

Programmatically Creating MapView and Adding a Marker Results in a null pointer exception in the fragment

不问归期 提交于 2019-12-22 11:50:13
问题 I am trying to create a MapView programmatically and add a MarkerPosition as shown below: MapView mapView = new MapView(getActivity()); ((ViewGroup) rootView).addView(mapView); GoogleMap googleMap = mapView.getMap(); googleMap.addMarker(new MarkerOptions() .position(new LatLng( Double.parseDouble( mEvent.getEventInfo().mEventData.mLat), Double.parseDouble( mEvent.getEventInfo().mEventData.mLng))) .title("Marker")); Manifest File: <uses-permission android:name="android.permission.ACCESS_COARSE

The method findViewById(int) is undefined for the type Get Data Fragment for Accelerometer Sensor

前提是你 提交于 2019-12-22 10:50:38
问题 I'm doing my project for getting data by acceleometer sensor in android platform. I'm having error codes in the 3 last line codes. Exactly the error is the findViewById is not for get data fragment. so, how I can use findviewbyId in Fragment for getting data accelerometer sensor?many thanks for the answer :) import android.app.Activity; import android.app.Fragment; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorManager; import android.os.Bundle;

fragments and handling orientation changes

拈花ヽ惹草 提交于 2019-12-22 10:04:29
问题 i have an activity with a fragment in it. I would like to handle the orientation change myself, so i updated the manifest to look like this: <activity android:name="com.test.app" android:configChanges="orientation|keyboardHidden"/> Then i updated the activity to look like this: @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); updateLayout(); } and @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Fragment replace() not replacing all fragments

风格不统一 提交于 2019-12-22 08:17:31
问题 If I call add() for fragments A and B with the same viewId and then try to call replace() on that viewId with fragment C, only fragment A is getting removed, ending up with fragments B and C. According to the docs, BOTH A and B should be replaced by C...or am I reading the docs wrong? Here's one combination that does this: public class FragmentActivity extends SherlockFragmentActivity { @Override public void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Switching orientation error: Fragment Error - Duplicate id, tag, or parent id 0x0

别说谁变了你拦得住时间么 提交于 2019-12-22 08:10:37
问题 I have a Fragment SearchPageFragment (representing the main view on a tablet) which itself contains two fragments inside of it: <fragment android:name="com.test.fragments.SearchFormFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="2dp" android:id="@+id/searchFormFragment" android:tag="searchFormFragmentTag"> <!-- Preview: layout=@layout/fragment_search_form --> </fragment> <fragment android:name="com.test.fragments.SearchResultsFragment"