android-intent

How to pass information between Activities

血红的双手。 提交于 2019-12-24 06:38:56
问题 I have asked this question a few times on here already, but still am not confident enough to start throwing things into my code because I'm afraid I'll ruin the functionality it already has. What I want to do is have a Bluetooth connection with a device that I can send/receive data to/from, and be able to access it from several different Activities. I know Intents can be used, but can anyone try to explain how intents work? I don't understand how if I start with an Activity, how I can build

application is not intercepting url

主宰稳场 提交于 2019-12-24 06:34:27
问题 I am trying to intercept my own app's URL on android so that the user can open the URL in the app rather than on the browser. (I don't have browser support yet). This is what I'm doing <activity android:name=".ui.activity.MainActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.PICK_ACTIVITY" />

The application has stopped unexpectedly!

巧了我就是萌 提交于 2019-12-24 06:18:10
问题 I have two class as trial.java and ImageWoLab0.java(Image without lable 0).When I run my application I am getting error as : The application has stopped unexpectedly !! public void onClick(View v) { switch (v.getId()) { case R.id.btnSequence: Intent intent1 = new Intent(); intent1.setClass(this,ImageWoLab0.class); /*To open new Screen/Activity */ //intent1.putExtra("String_key", "value"); /*Passing a key/value(Condition) to Activity2.class*/ startActivity(intent1); /*open the new screen

Passing Bluetooth device to a service, null getParcelableExtra

浪子不回头ぞ 提交于 2019-12-24 05:57:55
问题 I am trying to maintain bluetooth connection when the screen is off. So I created an app that you can discover bluetooth devices around and choose from list. Then pass the chosen bluetooth device to backgroundService class which will handle the rest.But I am getting null pointer when I try to get device from intent. Any help will be appreciated. Here is my code segments @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { if(btAdapter.isDiscovering()){

Opening an email with multiple attachments, while restricting the chooser to ONLY email apps?

喜欢而已 提交于 2019-12-24 05:49:30
问题 What is the best way on Android to send an email with multiple attachments without having non-email apps in the chooser ? When sending emails, I used to do it like this: final Intent sendEmailIntent = new Intent(Intent.ACTION_SEND); sendEmailIntent.setType("message/rfc822"); sendEmailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "test@test.com" }); ... Unfortunately, "message/rfc822" no longer works well for filtering out undesired apps from the chooser, such as Evernote, Drive, and

How to get default device assistance app in android by code?

痞子三分冷 提交于 2019-12-24 05:45:19
问题 my phone installed two voice searches: google app and S-voice app. The default app is S-voice app as figure bellow. My question is that how can we get the default voice application using programmingcally in Android 6.0. Thank you in advance This is what I did private boolean isMyAppLauncherDefault(String myPackageName) { final IntentFilter filter = new IntentFilter(Intent.ACTION_MAIN); filter.addCategory(Intent.CATEGORY_HOME); List<IntentFilter> filters = new ArrayList<IntentFilter>();

onActivityResult() not called after startActivityForResult() with Intent.ACTION_GET_CONTENT

安稳与你 提交于 2019-12-24 05:18:10
问题 I got my main Activity which holds different Fragment 's, one fragment gives the user a possibility to open a DialogFragment . That dialog opens a list of sound files and the dialog also contains a 'Add' button from which the user should be able to add her own soundfile. To do this I thought to use the standard Android file picking functionality and make use of the Intent.ACTION_GET_CONTENT . So I fire away this intent when the user presses the 'Add' button and the Android file picking

Android - Intent.setType() arguments

老子叫甜甜 提交于 2019-12-24 04:52:12
问题 Does anyone know all available arguments for this method? Like "image/..." or "file/..."? I didn't found a clue for that list in official documentation. Speccially, I need an intent to send contact (.vcf) file. But type "file/vcf" doesn't show me send via sms option. sendIntent.setData(Uri.parse("sms:")) Also didn't help Thanks 回答1: The Intent.setType() takes the MIME type as an argument. The MIME type is text/vcard 回答2: How about Intent.setAction ? For example to send sms: intent.setAction

How to add gallery button to Camera open with intent?

∥☆過路亽.° 提交于 2019-12-24 04:40:53
问题 In my app users are able to make a photo with camera. And I start it using intents: Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Now when open camera lacks the gallery button which would allow user to pick one of existing images from his SD card. Is it possible to show this button? 回答1: You can't really change the things camera intent has to offer, and if you do find a device where the camera app would let you access the gallery I wouldn't depend on it. I would recommend that

Going back and forth between intents without losing user entered data

霸气de小男生 提交于 2019-12-24 04:18:37
问题 I have a form. Here, the user fills in details like event name, description, location etc. To select the location, I have set a button. This is my button code: btnMap.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent map = new Intent(getApplicationContext(), Map2.class); startActivity(map); } }); I select the location from there, and the data is passed back to my main intent correctly. But the thing is, the data