android-intent

Stop an intent after a redirection to setting menu

∥☆過路亽.° 提交于 2020-01-13 05:37:07
问题 I'm currently developing an app which uses GPS location on googleMaps view. I check if GPS feature is activated, and if not I redirect the user to the setting menu. If I click on Back button (by activating or not the GPS) I come back to my app - works fine If I click on Home button, and then relaunch my app, I am directly redirected to the GPS setting menu => my intent is still on. The problem is that I do not know when kill this intent. Here is the incriminated part of my code: Button

Insert 3 images dynamically to horizontal scrollview or Viewpager

我怕爱的太早我们不能终老 提交于 2020-01-13 05:35:19
问题 There is an image shown below for what I am looking for. Currently I am using view pager & circle indicator. In view page it is showing only a single image. I want in one viewpager three images as shown in pic. When I slide that page, again three different images loaded form server with text below. How to do this? Any idea regarding this or any other way to achieve this? My code is shown below. I add some xml layout here: homespizzaview.xml <LinearLayout android:id="@+id/linearLayoutbutton"

send Arraylist by Intent

妖精的绣舞 提交于 2020-01-13 03:53:08
问题 How can I receive a custom ArrayList from another Activity via Intent ? For example, I have this ArrayList in Activity A: ArrayList<Song> songs; How could I get this list inside Activity B? 回答1: The first part to understand is that you pass information from Activity A to Activity B using an Intent object, inside which you can put "extras". The complete listing of what you can put inside an Intent is available here: https://developer.android.com/reference/android/content/Intent.html (see the

Using Android USB Host API to read my USB game controller/Or other USB device data

天涯浪子 提交于 2020-01-13 03:35:18
问题 I am trying to use Android USB Host API to read my USB game controller data, once I get this to work, I will connect other device to test. My game controller is connected to my Android phone using OTG cable. I am now able to get device, endpoints information, but I don't know how to read the raw data and display it. Can someone please help me? Some example codes will be appreciated. TextView countDisplay; ArrayList<String> listItems = new ArrayList<String>(); ArrayAdapter<String> adapter;

XMPP events on Android

…衆ロ難τιáo~ 提交于 2020-01-13 03:19:26
问题 I'm trying to develop a background process that intercepts a XMPP message and performs an action, I'm using asmack as the main XMPP library. I presume I need a broadcastReciever that responds to a specific intent. The question is how to raise the intent? It must be possible as this functionality is present in the google talk client. many thanks in advance. 回答1: If you really want to achieve this behavior, you might think about a persistent background service running the asmack XMPP client.

Clear activity stack in android

旧城冷巷雨未停 提交于 2020-01-12 11:51:11
问题 I have a LoginActivity as my launcher screen. And SettingsActivity as my fifth screen . I have a logout button in settings screen. On clcik of this button, how can i go to Screen-1 (i.e LoginActivity) by clearing all remaining activities (i.e 2nd, 3rd, 4th) from activity stack? Note : i have finished LoginActivity but not remaining activities. Thanks in advance 回答1: Simple, set an onclick on your logout button and then add this to your intent: Intent newIntent = new Intent(this, login.class);

want to open whatsapp to chat with a unsaved contact number in android app

自闭症网瘾萝莉.ら 提交于 2020-01-12 06:14:32
问题 i want to open whatsapp chat box for some number which is not saved in user mobile. I am using below code : Uri uri = Uri.parse("smsto:" + str_MobileNumber); Intent i = new Intent(Intent.ACTION_SENDTO, uri); i.putExtra("sms_body", "Hello"); i.setPackage("com.whatsapp"); mContext.startActivity(i); But whatsapp is showing error : 回答1: Sorry for late reply. I suppose your problem must be solved by now. You can try following code to open conversation for not saved numbers: private void

want to open whatsapp to chat with a unsaved contact number in android app

让人想犯罪 __ 提交于 2020-01-12 06:14:27
问题 i want to open whatsapp chat box for some number which is not saved in user mobile. I am using below code : Uri uri = Uri.parse("smsto:" + str_MobileNumber); Intent i = new Intent(Intent.ACTION_SENDTO, uri); i.putExtra("sms_body", "Hello"); i.setPackage("com.whatsapp"); mContext.startActivity(i); But whatsapp is showing error : 回答1: Sorry for late reply. I suppose your problem must be solved by now. You can try following code to open conversation for not saved numbers: private void

Passing image to another activity

混江龙づ霸主 提交于 2020-01-12 03:53:27
问题 I figured out how to pass a String value between activites thanks to this site, however I'm having trouble passing an image. What I'm trying to to is have a user click a button that opens the gallery and allows selecting of a picture. Then I have another button that opens another activity that displays an ImageView. I want to be able to have that ImageView's image be the chosen one from the previous activity. Here is the class that has the button I'm clicking to open the gallery and retrieve

Open my app from a link

情到浓时终转凉″ 提交于 2020-01-11 14:36:05
问题 In my app the server send this link: appname://veryfy?email=test@mail.com&token=asdf-asdf-asdf-xcfghfgh but is it possible to get the values like email= test@mail.com and the token = sdfdkgdkgjgfd . So far I've only added this intent filter inside my manifest but the app is not called: <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.SEND"/> <category android:name=