fragment

Don't want to refresh tabsactivity when call from activity android

让人想犯罪 __ 提交于 2019-12-24 17:24:29
问题 I am trying to stop refreshing my tabs activity, in the below pictures, you can see when I start new activity from tab fragment and then close it by pressing back button and returning to the tabs activity, all tabs will be restarted. I need to somehow resume tabs activity, In the codes below, I call new activity: Intent i = new Intent(context, New_Activity.class); startActivity(i); and close it in this way: finish(); 回答1: Instead of finish just use flag for it like this way Intent intent =

how to confirm quit application in fragment ? when user press back key

℡╲_俬逩灬. 提交于 2019-12-24 15:19:19
问题 i am creating an applicaiton with different fragments. I want to add code to listener for back key event and confirm with user if he wants to exit the app or not.. public class FastivalesFragment extends Fragment { public FastivalesFragment(){ } CustomAdapter adapter; List<EventClass> tempRows = new ArrayList<EventClass>(); EditText searchTxt; ListView list; View view; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Log.d(

Android, java.lang.IllegalArgumentException: No view found for id [..] for fragment [..]

最后都变了- 提交于 2019-12-24 15:06:05
问题 I try to open a dialog in which I have a FrameLayout. While loading a fragment in the Layout I get this exception: java.lang.IllegalArgumentException: No view found for id 0x7f080044 (...id/selectionlayout) for fragment ScenesFragment{4166e8a0 #3 id=0x7f080044} I loaded the Parentlayout correctly and everything else seems correct as well. AlertDialog.Builder builder = new AlertDialog.Builder(main); // Get the layout inflater LayoutInflater inflater = main.getLayoutInflater(); final View v =

android Fragment issue with orientation change

安稳与你 提交于 2019-12-24 14:34:59
问题 I have activity and two layouts for it defined: layout-large-land layout 1st layout is for large screens in landscape mode, 2nd is for other cases. The 1st layout contains: fragment1 fragment2 The 2nd layout contains: fragment1 When I start the app in landscape mode on large screen, the getSupportFragmentManager().findFragmentById() called in Activity.onCreate() correctly returns both fragments. After orientation change to portrait, getSupportFragmentManager().findFragmentById() returns not

Android - class is not a view android.support.v4.fragment

孤街醉人 提交于 2019-12-24 13:49:45
问题 I have to use fragment, with v4 support, but I've got an error crashing the App. I can't find the solution! This is my code : activity_advert_list.xml : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <android.support.v4.app.Fragment android:id="@+id/advertListFragment" android:layout_width="match_parent" android:layout

set error TextInputLayout in Fragment

旧时模样 提交于 2019-12-24 13:49:07
问题 I have an issue with TextInputLayout when I set the error message. I'm using the following package 'com.android.support:design:23.1.1' in a Fragment. This is the code if (tvName.getText().toString().trim().isEmpty()) { textInputLayoutName.setErrorEnabled(true); textInputLayoutName.setError("erreur"); } the XML part <android.support.design.widget.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/TextLabel" android:id="@+id/input

Fragment Shared Element showing abnormal behaviour in transition

最后都变了- 提交于 2019-12-24 13:24:01
问题 Here is my code: DetailsFragment fragment = new DetailsFragment(); Transition changeTransform = TransitionInflater.from(getActivity()).inflateTransition(R.transition.change_image_transform); Transition explodeTransform = TransitionInflater.from(getActivity()). inflateTransition(android.R.transition.explode); setSharedElementReturnTransition(changeTransform); setExitTransition(explodeTransform); // Setup enter transition on second fragment fragment.setSharedElementEnterTransition

How can I implement a delete button in a ListView and delete from database?

こ雲淡風輕ζ 提交于 2019-12-24 12:12:13
问题 I'm very new to android and I was given a prewritten app that I must improve. One thing I have to do is add a delete button to each item in a ListView. Here is the XML for my ListView element: LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50dp" android:descendantFocusability="blocksDescendants" android:orientation="horizontal" > <ImageView android:id="@+id/li_map_image" android:layout_width="50dp" android

what does onBackPress call in a Fragment

时光毁灭记忆、已成空白 提交于 2019-12-24 11:07:05
问题 In a Fragment i have this: onPause(){ super.onPause(); if(flag){ getActivity.finish(); }else{ } } onResume(){ flag = true; super.onResume(); } and there is a Button, on click i set this flag to false: Button.onClick{ flag = false; } The idea is: when the button is clicked don't finish this Activity. But when device BackButton is pressed finish(). But this logic isn't working. The reason is, when i press BackButton of the device, onPause is not being called. This is the 4th Fragment in the

ui:fragment rendered attribute not working after upgrading Facelets to JSF 2

守給你的承諾、 提交于 2019-12-24 09:58:54
问题 I am upgrading a project from JSF1.2/Facelets1.1 to JSF2.1 with built in facelets. The following no longer works and I don't know why. Both ui:fragments apparently evaluate to true, and both the link version and the plain text version are rendered: <ui:fragment rendered="#{rootcauseid ne rc.id}"> <a href="#{request.contextPath}/viewrootcause.jsf?rootcausenum=#{rc.id}">Root Cause #{rcRowCounter + 1}</a> </ui:fragment> <ui:fragment rendered="#{rootcauseid eq rc.id}"> <h:outputText value="Root