activity

Saving data in edittext when hitting Back button

匿名 (未验证) 提交于 2019-12-03 03:04:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So on activity 1 I click a button that takes me to activity 2. In activity 2 I enter some data into an EditText. When I hit the back button on the phone it takes me to activity 1 which is correct but if I hit the activity 1 button again any text that I entered into the EditText is gone. I am sure this is because I am starting a new Intent every time I hit my button and I think I need to be using Flags but I am not certain. Below is my basic MainActivity1 and MainActivity2 without the code I tried that didn't work. **Edit: After exiting the

React Native: Android activity go back

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I implemented android native module from Bambora SDK and displayed its native view(activity) by getCurrentActivity().startActivity(intent); It works like a charm but finish() makes whole app quit instead of going back. Here are some of my codes. public class ToastModule extends ReactContextBaseJavaModule { @ReactMethod // Calling module function from ReactJS code and works well public void goToRegisterCardView(Callback callback) { Intent intent = new Intent(getCurrentActivity(), NativeCardRegistrationActivity.class); getCurrentActivity()

DialogFragment crashes Activity when calling startActivity()

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a DialogFragment that was supposed to be simple but it's giving me some big problems specifically on Jelly Bean. The app uses the network and it pops a dialogue asking the user to turn on WiFi or cancel then closes it. So it extends DialogFragment and creates view as: @Override public Dialog onCreateDialog ( Bundle savedInstanceState ) { AlertDialog a = new AlertDialog . Builder ( getActivity ()). setCancelable ( true ). setTitle ( R . string . dialog_title_disabled ) . setMessage ( R . string . dialog_text ) .

No intent from UserRecoverableAuthIOException using Drive SDK for Android

匿名 (未验证) 提交于 2019-12-03 03:03:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've implemented google drive into my android application and it work pretty nice, but I'm trying to figure out a way to run an upload/download in a background thread so that I can leave an activity and do something else on my app. The problem is, drive needs the activity reference in case of exceptions, such as UserRecoverableAuthIOException . Here's the issue I cannot understand. Here's some try/catch code: try { //...drive api stuff here } catch (UserRecoverableAuthIOException e) { possibleException = e; try { e.getIntent(); } catch (

FusedLocationApi.getLastLocation always null

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to simply retrieve device location in my Android project and in order to do so I use the play-services approach: protected synchronized void buildGoogleApiClient() { mGoogleApiClient = new GoogleApiClient.Builder( MainSearchActivity.this ) .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() { @Override public void onConnected( Bundle bundle ){ Location location = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); if( location == null ){ LocationServices.FusedLocationApi.requestLocationUpdates

Why does resuming an activity in android cause BadTokenException?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Folks - Can anyone explain this stack? Note that my code is nowhere on it. If you Google for any of these exceptions, everyone who has experiencing this issue was trying to create dialogs after an activity was terminated, which doesn't seem to be the case here. It's just a simple activity resume. I am seeing this exception reported from clients in the field quite frequently and would like to correct it if possible. android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@405177d8 is not valid; is

Call parent's activity from a fragment

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: If I'm inside a Fragment how can I call a parent's activity? 回答1: Yes, Its right by calling getActivity and cast it with parent activity to access its methods or variables ((ParentActivityName)getActivity()) Try this one. ParentActivityName is parent class name 回答2: The most proper way is to make your Activity implement an Interface and use listeners . That way the Fragment isn't tied to any specific Activity keeping it reusable. Into the Fragment : @Override public void onAttach(Activity activity) { super.onAttach(activity); // This makes

Start android activity from cordova plugin

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know this may is a duplicate question, i have tried all answers from stack, but non has a complete answer. Most answers just give how to start an activity but no hints how to configure activity in Android Manifest file and where to save activity layout and manifest file. Can anyone please give a complete code structure to start an activity from cordova plugin. 回答1: Here is the complete steps to start an activity from a cordova plugin 1. Install Plugman to create plugin npm install -g plugman 2. Create cordova plugin using plugman plugman

Are Activity/Fragment Transitions compatible with pre-Lollipop devices?

匿名 (未验证) 提交于 2019-12-03 02:51:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to make an Activity Transition using Shared Elements on a pre-Lollipop device (4.x). Is it possible? So far, I'm trying this: public class RewardDetail extends ActionBarActivity { @Override public void onCreate(final Bundle savedInstanceState) { ... ViewCompat.setTransitionName(imageView, TRANSITION_NAME); } ... public static void launch(ActionBarActivity activity, View transitionView, WelcomeReward detailData) { ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, transitionView, TRANSITION

ActivityNotFoundException (YES, this activity is declared in AndroidManifest.xml)

匿名 (未验证) 提交于 2019-12-03 02:51:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I found a few threads reporting a similar problem but none of them really offers something that I haven't tried already. An innocent such call: mActivity . startActivity ( new Intent ( mActivity , MyEditPreferences . class )); with the following in AndroidManifest.xml: <application> <activity android:name = "MyActivityLib" /> <activity android:name = "com.example.baseapp.MyEditPreferences" android:label = "@string/app_name" > </activity> </application> Triggers the following exception: 06 - 14 14 : 06 : 50.297 : ERROR /