Tag: android-intent

How do I receive a “Share URL” from browser?

I read this ( How do I handle the browser's "share page" intent in android? ) which I can get the Share link to detect my app, now how do I get Activity to receive the URL? Found Answer: Intent intent = getIntent(); if (savedInstanceState == null && intent != null) { Log.d(TAG, “intent != […]

Permission issue while starting a service from android

I have written a service as part of an application. I try to call this service from a second application using the following code: Intent intent = new Intent () ; intent.setClassName(“com.test” ,”com.test.DownloadService”) ; // Create a new Messenger for the communication back Messenger messenger = new Messenger(handler); intent.putExtra(“MESSENGER”, messenger); intent.setData(Uri.parse(“http://www.vogella.com/index.html”)); intent.putExtra(“urlpath”, “http://www.vogella.com/index.html”); this.startService(intent); It […]

Why Use Start Activities?

I’ve been looking through the API documentation, and noticed starting with API level 16 the Context class includes the following method: public abstract void startActivities (Intent[] intents) I’ve been Googling around in attempts to stave my curiosity through an example of it’s use in application code, a question, or article, but I haven’t come across […]

Android-Libgdx, Calling Another Activity after the Game starts on Button click

I faced a major problem when I need to call another activity when the button is clicked after the Game is started. The Game is called via initiate(game, ) method from AndroidApplication interface. In normal Activity, I can easily call the another Activity but it seems to be difficult to call another Activity from Libgdx […]

Register to be default app for custom file type

Register to be able to open files of custom type. Say i have .cool files, and if the user tries to open it, Android asks if they would like to open it with my application. How?

Open page in Facebook,Twitter and Google Plus app from other app – Android

I’m working on an application where I need to integrate the social functionality of the different social networks: Facebook, Twitter, Google+. For now, in Facebook and Twitter i’m recognized if the user has a native application and if he does, I’m opening it and show him my fan page. For Twitter I use the next […]

Call startActivityForResult from Fragment doesn't call onActivityResult

I have a DialogActivity which is called from a Fragment for show a custom Dialog with two image buttons. In DialogActivity.onCreate final Dialog dialog = new Dialog(this, R.style.DialogTheme); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.dialog_pause); dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT)); dialog.show(); In DialogActivity.onClick @Override public void onClick(View v) { Log.d(LOGTAG, “onClick CONTINUE”); Intent resultData = new Intent(); resultData.putExtra(“TEST”, “return data”); setResult(666, resultData); dialog.cancel(); […]

Launch google maps application for driving directions in android

Here is how I’m launching native google maps app to show the directions between my & target locations. String url = “http://maps.google.com/maps?saddr=”+currentLattitude+”,”+currentLongitude+”&daddr=”+targetLat+”,”+targetLang; Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(url)); intent.setClassName(“com.google.android.apps.maps”, “com.google.android.maps.MapsActivity”); startActivity(intent); Is there any way to launch native maps app to show driving and transit modes? (Currently its showing only walking directions)

Context wants FLAG_ACTIVITY_NEW_TASK but I've already set that flag

I’ve created a common re-usable class for the company I work for to create some common interface elements. The class, takes in a single parameter as in the construct: an application context. one of the methods, ContentClickableRowWithIcon allows you to pass in an intent to be used as the click action. heres the full method […]

Check for resultCode in Android's BroadcastReceiver?

I want to make a check if resultCode is RESULT_OK in Android’s BroadcastReceiver‘s onReceive method like we do in onActivityResult method of an Activity, but how will I do that is my question. Receiver’s code is: new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub //This is what […]

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