onbackpressed

Not working onbackpressed when setcancelable of alertdialog is false

风格不统一 提交于 2020-05-20 07:35:07
问题 I have an AlertDialog and its setCancelable() is false. In Onbackpressed function I want the AlertDialog to be closed. But when setCancelable() is false, the back key doesn't work at all. What should I do to get rid of this problem? I don't want to change setCancelable() to true because I will have another problem. import android.os.Bundle import android.widget.Toast import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AppCompatActivity class MainActivity :

how to update a specific item (cardview) in recyclerview OnActivityResult

荒凉一梦 提交于 2020-01-24 19:40:25
问题 I have a Fragment inside MainActivty, and inside this Fragment RecyclerView of Articles with cardView (inside this card i have like button and like counter) and when the user click on the cardView will open DetailsActivity that and I want when onBackPressed to update just this item depends on the data changed (like button and like counter) in DetailsActivity how to update just this Item ? sorry for bad English! 回答1: First update the data of that specific position item of adapter. After that

how to update a specific item (cardview) in recyclerview OnActivityResult

两盒软妹~` 提交于 2020-01-24 19:40:06
问题 I have a Fragment inside MainActivty, and inside this Fragment RecyclerView of Articles with cardView (inside this card i have like button and like counter) and when the user click on the cardView will open DetailsActivity that and I want when onBackPressed to update just this item depends on the data changed (like button and like counter) in DetailsActivity how to update just this Item ? sorry for bad English! 回答1: First update the data of that specific position item of adapter. After that

onBackPressed in Fragment Google Maps

大憨熊 提交于 2020-01-07 02:01:37
问题 I have a main activity, with the fragment that switches, something simple Activity main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <include layout="@layout/toolbar" android:id="@+id/toolbar"></include> <FrameLayout android:id="@+id/fragment_container" android:layout_width="match_parent"

Finish Activity not close in Android (Xamarin)

為{幸葍}努か 提交于 2020-01-03 05:15:11
问题 I have Two Activity one is InventoryActivity and Second is StoneDetailActivity . In my InventoryActivity have RecycleView In RecycleView Button Click I start the StoneDetailActivity using StartActivityForResult below code. Intent stonedetailIntent = new Intent(context, typeof(StoneDetailActivity)); stonedetailIntent.PutExtra("SearchitemObject", stoneJson); stonedetailIntent.PutExtra("position", position); context.StartActivityForResult(stonedetailIntent, 1000); context

Exit Full Screen Video Mode on Back Press

最后都变了- 提交于 2020-01-02 15:24:07
问题 I just started with this GMF example provided by Google. I would like to know How can I Exit Full Screen Video Mode by doing tap on back button, I tried using below code, but did not get any success, here you can see the actual code of MainActivity.java boolean isFullScreen = false; // globally declared @Override public void onGoToFullscreen() { isFullScreen = true; videoListView.setVisibility(View.INVISIBLE); } @Override public void onReturnFromFullscreen() { videoListView.setVisibility(View

Activity navigation: custom animation with popEnter and popExit like fragments

戏子无情 提交于 2019-12-28 18:23:10
问题 Changing activities with an animation is possible using the code below: Bundle animation = ActivityOptions.makeCustomAnimation(App.getContext(), R.anim.enter_from_right, R.anim.exit_to_left).toBundle(); startActivity(intent, animation); For fragments you can do something similar on FragmentTransaction: // ... transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left); // ... This works! But I'd like to have an animation when pressing back (pop from backstack). For fragments

onback pressed data not showing in fragments

点点圈 提交于 2019-12-28 06:54:10
问题 I am using navigation drawer in my app,I have fragments like F1,F2 and so on..and in every fragment I am parsing data and display in listview ,everything is works fine if I go through my app like F1>F2>F3 and so on..but the issue is if I go from F3 to F2,the data which I had in my F2 fragments is not showing,and display only blank page,what is the issue?Can any one help? My F1 public class Categriesdrawers extends Fragment{ private ImageView drwr; private SlidingDrawer sldrwr; private

Fragment Back stack from second fragment to first fragment

廉价感情. 提交于 2019-12-24 06:47:42
问题 I have viewpager tab fragment and from one tabb fragment on button click it open another fragment and another second fragment i want to add event of backpress as i am doing backpress it exiting application as i have written code of Double back press exit code in my root fragment and i dont want this code to call in my another second fragment as i want simply one step back to my previous fragment As here is the code R.id.Recharge -> { val pl = Payment_History() fragmentTransaction =

Undo the changes in listview onbackpressed

两盒软妹~` 提交于 2019-12-20 07:28:05
问题 I have a list view which contains list of products and on the click of the list item, list details gets open. The list item contains values like gross weight, net weight etc. On the top of the list item details page I have a cross button instead of back button which on click will open a dialog saying "Do you want to save the changes" and with the button yes or no. On pressing YES, I am able to save the changes in the list view but on pressing NO, am not able to undo the changes. Below is the