onbackpressed

List View should not load onBackPressed

◇◆丶佛笑我妖孽 提交于 2019-12-14 04:14:34
问题 I have Three Activities Main Activity , Order Activity , Order Details Activity. Order Activity has a list view . On click of list View Order Details activity is opened but on back pressed from Order Details Activity the list view is loading again how to stop list view from loading Again Please Help 回答1: @Override protected void onResume() { //****put your list view setup you already create in oncreate() method super.onResume(); } add bellow oncreate() method in main activity 来源: https:/

Customize back navigation

天大地大妈咪最大 提交于 2019-12-12 04:20:41
问题 First of all I read this article but is kind of complicated for me . All I need is to go to an activity I want (navigate if exist in back stack or start it with Intent if it's not ) in onBackPressed() override . should I manage back stack or something else ? if yes how ? and if no what is a simple way for that ? P.S : I dont use ActionBar 回答1: you should override the second activity's onBackPressed() method and add android:launchMode="singleInstance" to your first activity in AndroidManifest

An Image Downloaded From Parse Stay On Screen Even After You Exit And Reopen App?

不羁的心 提交于 2019-12-12 04:02:31
问题 I have an app that downloads an image from Parse.com and displays that image in an Image View The problem is that whenever I exit the app (with the back button) and return the image is gone. How can I make the image stay? (For example: when you update your profile pic on Twitter and leave the app and return your profile pic will still be displayed) Any help would be greatly appreciated this is very important. MainActivity: public class MainActivity extends Activity { Button button; private

adding functionality to back key in android to go to previous folder location in a file manager

好久不见. 提交于 2019-12-12 03:29:14
问题 I know this has been discussed so many times but really I am not able to figure it out. I am so sorry for asking it again. I am making android file manager. I am showing the files and folders in a listview. I want to add functionality to "back" key. Currently pressing back key at any time results in exit from the app. I want it to go to the previous folder if any or otherwise exit the app. I was trying onBackPressed() method but couldn't figure out what should be written there. Please help me

How to end AsyncTask onBackPress()

青春壹個敷衍的年華 提交于 2019-12-12 01:55:38
问题 how to stop asynctask on android backpress i want to stop this activity so that when it goes back to previous activity this activity is completely closed this activity does its work in background , as it is supposed to do, my problem is when we click the android back button this activity should completely stop and go back to first activity i did somne search and came to know the asynctask should be stopped on back press i tried that but ii doesnot seem to work how can this be done in the

Android Fragment onBackPressed display alertDialog

喜欢而已 提交于 2019-12-11 10:26:26
问题 I'm currently using Fragment with Backstack. In one of the fragment e.g " Menu " I wanted to prompt an alertdialog when user tapped on back button. But I'm having some problems in achieving that. I listed two scenario below that I tried. Scenario 1: I added a KeyListener in the " Menu " fragment that will trigger when user tapped on back button. I add another fragment on top of " Menu " called " Report ". When I pressed back button in " Report " fragment it will still prompt out the

OnBackPressed not following backstack; goes directly to home Fragment

回眸只為那壹抹淺笑 提交于 2019-12-11 08:54:41
问题 I'm in a pickle and can't understand what's going on. I have my app using an OnBackPressed with a closing window and a home screen check, in short "if home, else, use exit menu" @Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.START)) { drawer.closeDrawer(GravityCompat.START); } else if (!viewIsAtHome) { displayView(R.id.nav_large_monsters); } else { new AlertDialog.Builder(this) .setMessage(

Parent activity loses data when onBackPressed() is called

风流意气都作罢 提交于 2019-12-11 06:36:32
问题 I have a listview in subsection activity when I click on it, it opens up tabbed activity. Now when I press up navigation button on top left corner and go back to parent activity, the listview becomes empty. But when I press back button on the keypad the parent activity does not lose its data. The listview is populated using the database. Please help me! SubSectionActivity.java (Parent Activity) package com.suvariyaraj.algorithms; import android.content.Context; import android.content.Intent;

webView.canGoBack() not working anymore

落花浮王杯 提交于 2019-12-11 06:02:24
问题 Recently all of my WebView based apps started to have problem with back button. It looks an issue with update of some Android Component, Kindly help with the issue or some alternative solution? webView.canGoBack() always returning false . PS: All apps were working fine in previous days. I'm using it like this: @Override public void onBackPressed() { if (webView.canGoBack()) { webView.goBack(); } else { super.onBackPressed(); } } 回答1: Create own canGoBack by like this.... ArrayList<String>

In Kotlin ..How I can return from fragment to MainActivity

南笙酒味 提交于 2019-12-11 05:06:38
问题 in my program I have MainActivity and many fragments.. I try the following code to return from fragment to MainActivity by onBackpressed() method override fun onBackPressed() { if(drawer_layout.isDrawerOpen(GravityCompat.START)) { drawer_layout.closeDrawer(GravityCompat.START) } else if (fragment != null) { val intent = Intent(applicationContext, MainActivity::class.java) intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP startActivity(intent) } else { super.onBackPressed() } } My first problem is