android-intent

Preventing main activity from being launched if running already

走远了吗. 提交于 2019-12-22 05:58:26
问题 I have an application that is launched via an intent-filter action. The problem is that every time the event/ action occurs, Android displays a dialog asking to launch the app even if it is already started. I want the behavior to be as follows: User asked to launch the app if app is not open. Dialog does not display if app is running in the foreground. Is there a way to achieve both of these goals? I am targeting Android 4.0. edit Here is my intent filter: <intent-filter> <action android:name

Safeguard against “a matching Activity may not exist” in android settings

試著忘記壹切 提交于 2019-12-22 05:40:29
问题 The majority of the Activity Actions (used to launch various Settings activities) in the Settings class come with a warning : In some cases, a matching Activity may not exist, so ensure you safeguard against this. So how do I safeguard against this ? try { final Intent i = new Intent(Settings. ACTION_WIRELESS_SETTINGS); // say i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // not sure if needed startActivity(i); } catch (Exception e) { // what should I catch here // I would hate to catch

Standard intent URI broken?

a 夏天 提交于 2019-12-22 05:39:06
问题 I'm having problems with intent URIs on a particular device, so I tried the CommonsWare URLHandler sample as suggested here: Launching my app using the intent URI, and the intent URI hyperlink on its sample page also fails to invoke the application. The sample declares its intent-filter like this: <intent-filter> <action android:name="com.commonsware.android.MY_ACTION" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" />

how to start a new activity after login success?

穿精又带淫゛_ 提交于 2019-12-22 05:18:13
问题 i want to start a new activity after login success. that is when login goes correct a new activity should start automatically...i dont know where to mention startactivity. please help me with this, im a newbie to android. this is my code... public class BackgroundTask extends AsyncTask<String,Void,String> { AlertDialog alertDialog; Context ctx; BackgroundTask(Context ctx) { this.ctx =ctx; } @Override protected void onPreExecute() { alertDialog = new AlertDialog.Builder(ctx).create();

Android Explicit Intent throws NoClassDefFound error

青春壹個敷衍的年華 提交于 2019-12-22 05:17:23
问题 I'm trying to use an explicit intent to display a MapView in my android app. Although I don't see anything wrong with my code, I keep getting a "NoClassDefFoundError" when I try to start my activity. Basically, from my main activity (SetCriteria), I create the explicit intent when user presses a button : Log.i(TAG, "Showing map.."); try{ Intent intentMap = new Intent(view.getContext(), AddLocation.class); startActivity(intentMap); }catch(Throwable ex) { Log.e(TAG, "Error occured while trying

Launch Activity From URL

做~自己de王妃 提交于 2019-12-22 05:17:20
问题 I am trying to have my application launch when the user browses to a certain url. I have found a few examples and they all have the same things in the manifests but it's not working for me. I have put the intent-filter under an Activity as well as a Receiver. Here is my manifest snippet: <intent-filter> <action android:name="android.intent.action.VIEW"></action> <category android:name="android.intent.category.DEFAULT"></category> <category android:name="android.intent.category.BROWSABLE"><

Why does the Intent that starts my activity not contain the extras data I put in the Intent I sent to startActivity()?

天大地大妈咪最大 提交于 2019-12-22 05:13:19
问题 I explained this badly originally. This is my question: The Intent I send to the startActivity() method, contains a private field, mMap, which is a Map containing the strings I sent to putExtra(). When the target activity starts, a call to getIntent() returns an Intent that does not contain those values. The mMap field is null . Obviously, something in the bowels of the View hierarchy or the part of the OS that started the new activity created a new Intent to pass to it, since the object IDs

Difference between getExtras(name).getString and getIntent().getStringExtra(name)

て烟熏妆下的殇ゞ 提交于 2019-12-22 05:01:20
问题 I have some error reports on my Android app, it's a Nullpointerexception in onCreate() in an Activity. The code that fails is getIntent().getExtras().getStringExtra("name"). (Nullpointerexception) That means that getExtras() is null somehow. I am sure that I am setting the intent extra on every place I am creating the intent. I can't recreate it on my emulator on device. I think it happened on my real device (but not while I was debugging) after I tried to open the app again, in the mean time

Google Drive + ACTION_GET_CONTENT

江枫思渺然 提交于 2019-12-22 05:01:10
问题 It appears that Google Drive has an activity that responds to the GET_CONTENT action, but that it's not exported. Is there another method that I can use in my app to pull content out of Drive, without having to initiate the process from Drive? Writing a picker/chooser activity myself and using the backend APIs to list and open a file is obviously an option, but I'd much rather use Drive's own UI to do that. 回答1: Google Drive only has an activity that supports GET_CONTENT to support pre-API 19

Intent data not clearing when user presses back button then recent apps button

此生再无相见时 提交于 2019-12-22 04:48:14
问题 I am puzzled over this behavior I am experiencing in an application I am developing... Short: Intent data is not clearing out when the user presses the back button to leave the application and then presses the recent button to re-enter the application. (Every other case, the intent data is cleared out) Long: I have an application with a splash screen that is used to collect data that is passed in from a URI scheme. I then setup an intent to forward the data to the main activity. The main