android-intent

Android Studio mailto Intent doesn't show subject and mail body

随声附和 提交于 2020-01-23 12:29:09
问题 I'm trying to send an e-mail from my Android App. With the click on a button, gmail should open and show a new email with my previously defined recipient, subject and email body. So far I've tried sending the Intent.ACTION_VIEW as well as Intent.ACTION_SENDTO. Both show my draft with the recipient only. Both subject and message are being opressed. Weird thing is when using the emulator, it works just fine. Also was trying to lock at the android errorlog. Seems like i don't have permission. Is

RecyclerView - Get the selected position and pass the position to another activity where the same list will appear with that specific item selected

穿精又带淫゛_ 提交于 2020-01-23 12:25:23
问题 I have declared a ViewModel.class for the RecyclerView an Adapter and I have parsed to the MainActivity and to another Activity so I have the same adapter for both activities. I can show the parsed data in both activities but the problem it is I cannot take the data of the selected item to MainActivity and then to set to that btnSearch for a click so then I can share between activities the data from the selected item. Every time when the app is open the first item is selected. What I am

onActivityResult for Intent(Settings.ACTION_SETTINGS) called immediately

亡梦爱人 提交于 2020-01-23 10:08:44
问题 In my splash screen I have request to server, but when there's no internet connection i'm opening Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS); startActivityForResult(settingsIntent, REQUEST_ENABLE_CONNECTION); But problem is that onActivityResult is called immediately with requestCode = REQUEST_ENABLE_CONNECTION I've also tried to add the flag FLAG_NEW_TASK for the intent with no luck. The activity is not singleTop or singleInstance in the manifest . What is the best android

How to close Android application in Kotlin

末鹿安然 提交于 2020-01-23 09:21:25
问题 In JAVA we can close the application. We trying to develop skills with Kotlin and feel we are using the correct syntax to close the application. The issue is that the code only works if you close the app before going to the Second Page and back to the MainActivity which is the launcher activity code below fun onTV(view: View){ exitProcess() } private fun exitProcess() { //finish() System.exit(-1) } Both finish and System.exit(-1) work if selected first without navigating to PageTwoActivity

How to close Android application in Kotlin

泪湿孤枕 提交于 2020-01-23 09:20:19
问题 In JAVA we can close the application. We trying to develop skills with Kotlin and feel we are using the correct syntax to close the application. The issue is that the code only works if you close the app before going to the Second Page and back to the MainActivity which is the launcher activity code below fun onTV(view: View){ exitProcess() } private fun exitProcess() { //finish() System.exit(-1) } Both finish and System.exit(-1) work if selected first without navigating to PageTwoActivity

how to call the start activity from one java class

落花浮王杯 提交于 2020-01-23 06:43:05
问题 Is it possible to start an Activty using an Intent in a general java class which extends Activity ? import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Spinner; import android.app.Activity; import android.content.Intent; public class SubActivity extends Activity{ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } And a

how to start google map for result

喜你入骨 提交于 2020-01-23 01:55:19
问题 I want my user to enter an address. But I want the address to be confirmed with Google Map. So when the user clicks on a button to enter the address, I want to launch an Intent for Google Map where user can enter the address. But then I want the map to return the data to me. How do I do that? If I start my activity as Uri searchUri = Uri.parse("geo:0,0?z=10&q="); Intent mapIntent = new Intent(Intent.ACTION_VIEW,searchUri); mapIntent.setPackage("com.google.android.apps.maps");

Automatically revert to previous default SMS app

一笑奈何 提交于 2020-01-22 15:30:05
问题 I have an app that requires temporary access to the device's SMS. In KitKat and above, this access is only granted to the default SMS app, so I'm using: Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT); intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getPackageName()); startActivity(intent); This brings up a dialog asking the user if they let my app become the default SMS app. So far so good. Problem is, once my app completes its operation, I have to ask the

how to pass data from activity to running service

时光怂恿深爱的人放手 提交于 2020-01-22 14:33:19
问题 I want to send data to the server periodically, I'm using background Service for that, but I want to send when the data got updated, and updated data I'm getting in Activity and the Service is running in background.. so how can i pass data to running Service from Activity . Using Intent I can send data only one time while starting the Service . Intent serviceIntent= new Intent(DriverActivity.this,demoService.class); serviceIntent.putExtra("token", token); startService(serviceIntent); 回答1:

how to pass data from activity to running service

北战南征 提交于 2020-01-22 14:33:12
问题 I want to send data to the server periodically, I'm using background Service for that, but I want to send when the data got updated, and updated data I'm getting in Activity and the Service is running in background.. so how can i pass data to running Service from Activity . Using Intent I can send data only one time while starting the Service . Intent serviceIntent= new Intent(DriverActivity.this,demoService.class); serviceIntent.putExtra("token", token); startService(serviceIntent); 回答1: