Tag: android-intent

SecurityException: Not allowed to start service Intent act=com.google.android.c2dm.intent.REGISTER

I get the error SecurityException: Not allowed to start service Intent but looks like it do not have good solution after searching many topics. Please help me, Thanks, p/s : I’m make sure I used correct SENDER_ID as project number was defined at Google API Console and correct package name. Error : Caused by: java.lang.SecurityException: […]

Android Fatal Error – Can not perform this action after onSaveInstanceState

I’m attempting to perform a fragment transaction after requesting permissions in Android – however the app continually crashes. How might this code be changed in order to avoid this? Any assistance is appreciated. CHECK PERMISSIONS BEFORE SENDING EMAIL: private void emailShare() { if (mayRequestContacts()) { emailShareImpl(); } } CHECK PERMISSIONS: private boolean mayRequestContacts() { if […]

Get details about Intent of a PendingIntent

I was wondering if it’s possible to get some more info out of a PendingIntent that I haven’t created myself. To be more precise: is it possible to somehow retrieve the original Intent of a PendingIntent? I don’t need to execute it, but would like to print it’s contents. Looking through the code of PendingIntent […]

Android intent to open user's preferred browser

I’ve been trying to find out how to create an intent that will open the user’s preferred browser without specifying the URL. I know how to open it by giving a specific URL like this: Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setData(android.net.Uri.parse(“http://www.google.com”)); context.startActivity(intent); I don’t want to open the browser to any page in particular, […]

Fragment: which callback invoked when press back button & customize it

I have a fragment: public class MyFragment extends Fragment{ … @Override public View onCreateView(…){…} … } I instantiate it: MyFragment myFragment = new MyFragment(); I use the above fragment to replace the current fragment: FragmentManager fragmentManager = activity.getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); // replace fragment fragmentTransaction.replace(R.id.fragment_placeholder, myFragment, “myTag”); // NOTE: I did not add to […]

How to open up a specific SMS in android

Is there a way to open up the Messaging Activity on android with a specific SMS?


As stated in the documentation: “An app holding the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission can trigger a system dialog to let the user add the app to the whitelist directly, without going to settings. The app fires a ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS Intent to trigger the dialog.” Can someone tell me the proper way to fire this intent?

How to remove activity from recent apps list on finish?

I’m launching an activity from a service and want it to appear in the recent apps list. However, I want the activity to be removed from the recent apps list if I exit the application (e.g. press button on activity’s UI which calls finish()). Excluding the activity from the recent apps list with android:excludeFromRecents=”true” does […]

Error using onClickListener (Intent)

Well, I’m trying to create an intent on a “login.java” the code is : Button btEntrar = (Button) findViewById(R.id.btnSingIn); btEntrar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i; i = new Intent(this, MainActivity.class); startActivity(i); } }); But it says that I can’t go to the other activity saying this : Error:(24, 21) error: […]

Android widget onclick listener for several buttons

I am trying to create a widget for my application. From my reading an android developer site your onclick listeners all need to have an Intent. But what if I just want my button to update data in the widget itself and I don’t want to start a new activity? Here is some Android demo […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.