Tag: android-intent

Sharing NavigationView with all the Activities?

How do we share Drawer with all the activities? In the lister: onNavigationItemSelected of setNavigationItemSelectedListener we can get the id and navigate to it. What I am looking for is something like this: private void initDrawerLayout() { drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); NavigationView navView = (NavigationView) findViewById(R.id.navigation_view); navView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(MenuItem menuItem) { […]

ActivityNotFoundException trying to load Contacts ContentProvider?

This is a weird one. I am seeing this crash report on some devices: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.PICK dat=content://com.android.contacts/contacts } The intent that generates this error is: Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI); // pre-Eclair Or: Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI); // post-Eclair The device is simply reported as […]

Keeping alive Intent Service after application is killed

I have intent service in my app. This service has some job to do – uploading some files. It runs only when there is something to do. Service won’t upload when some conditions are met, for example no Internet connection. For that reason it registers itself to on broadcast receiver to receive message about Internet […]

Android package installer – how to get “Open” and “Done” and activity result both?

My Android Application has an option to upgrade to the newer version, the newer version APK I keep it available under a path in sdcard. On click of Upgrade option I invoke following method. public static void launchInstaller(Activity act, String apkPath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(apkPath)), “application/vnd.android.package-archive”); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); act.startActivityForResult(intent, 0); } The […]

Properly start Activity from Notification regardless of app state

I have an app with a splash screen Activity, followed by a main Activity. The splash screen loads stuff (database, etc.) before starting the main Activity. From this main Activity the user can navigate to multiple other child Activities and back. Some of the child Activities are started using startActivityForResult(), others just startActivity(). The Activity […]

How to know that an app is going to be uninstalled in android?

I want to implement something like AppLock application is doing. If in its settings it is set to lock applications uninstall/install, then while uninstalling any app (precisely on clicking the Uninstall button) a lock screen comes which asks for a password/pattern. Only after entering the password user is allowed to uninstall the app. What’s that […]

Why do we get these “invalid” intents?

We have an app with an Activity that can be started in two ways: From another Activity – always with some extra data filled in From deep linking As far as I can see this is always working just fine. We either get the Intent.ACTION_VIEW with a data URI, or we get some string extras. […]

Android url override doesn't work on redirect

I have a url that I am overriding in my Android App. Clicking a link from an email to that link pops up the Intent Chooser dialog (“Complete this using”). However clicking the same link (in an <a> tag) from within Chrome (on Android 4) redirects me to that url, and doesn’t offer the Intent […]

Android Intent for HTTP MP3 stream on HTC Incredible

On the stock Droid and Nexus One, an intent like this: new Intent(Intent.ACTION_VIEW).setDataAndType(Uri.parse(“http://example.com/somemp3.mp3”), “audio/mp3”); works just fine and pops open the system music player to stream the file. But it doesn’t match any activities on the HTC Incredible, causing a force-close when I call startActivity on it (I’m guessing due to missing intent filters in […]

open android activity in new task without using android:launchMode=“singleTask”

I’ve created a browser application with main activity which response to the following intents: <intent-filter> <data android:scheme=”http”/> <data android:scheme=”https”/> <category android:name=”android.intent.category.DEFAULT”/> <category android:name=”android.intent.category.BROWSABLE”/> <action android:name=”android.intent.action.VIEW”/> </intent-filter> On url click from other task (gmail, sms) if i choose my application, the activity is open in the same task as the calling task. When I choose different […]

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