android-intent

Android camera intent returns null… sometimes [duplicate]

我只是一个虾纸丫 提交于 2020-01-11 05:17:13
问题 This question already has answers here : Getting Uri Null in capture photo from camera intent in samsung mobile (3 answers) Closed 4 years ago . I am debugging my app in 2 different physical devices: Motorola Moto G, Android 4.4.2 LG OPTIMUS L5 II, Android 4.1.2 I am calling the camera in a button: buttonCamera.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent,

Intent to choose between the camera or the gallery in Android

蹲街弑〆低调 提交于 2020-01-11 04:33:26
问题 I'm trying to launch an intent to pick a image from the camera or the android's gallery. I checked THIS post and currently my code is near to work: private Intent getPickIntent() { final List<Intent> intents = new ArrayList<Intent>(); if (allowCamera) { setCameraIntents(intents, cameraOutputUri); } if (allowGallery) { intents.add(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI)); } if (intents.isEmpty()) return null; Intent result = Intent

Intent custom permission not working

纵然是瞬间 提交于 2020-01-11 04:00:26
问题 UPDATE My immediate problem is solved as per my answer below. My environment (PC + devices) does not allow custom permissions in DEBUG builds. I'm convinced I was able to run DEBUG builds fine a few weeks ago - hence the description of an "intermittent" error. UPDATE 2 The code synced out on a different developer's machine, works fine on his device in DEBUG mode through Eclipse. On my devices, it does not work from his machine. Also the DEBUG build from my machine works fine on this other

IntentService : How to enqueue correctly?

ε祈祈猫儿з 提交于 2020-01-11 03:14:06
问题 In my code i'm using an IntentService to listen to location updates (either GPS or network updates) and this IntentService is triggered when an event is received, so it is started with startService() from any activity. public class AddLocationService extends IntentService implements LocationListener { /*My code here*/ } @Override protected void onHandleIntent(Intent intent) { if(getOldLoc() == null) { //Get a new location this.locationManager.requestLocationUpdates(LocationManager.NETWORK

how to pass value data between classes/activity in Android?

浪子不回头ぞ 提交于 2020-01-10 20:14:53
问题 For example i have activity1, activity2, activity3 and lastly valueAllActivity? how do I pass the data from activity1, activity2, activity3 to --> valueAllActivity? to pass INT value in each activity to valueAllActivity. I am very new in developing Android program, so if anyone could guide, it would be an honor :) Thank you //Activity1 package lynn.calculate.KaunterKalori; import lynn.calculate.KaunterKalori.R; import android.app.Activity; import android.os.Bundle; import android.view.View;

share intent text in android studio using kotlin

痞子三分冷 提交于 2020-01-10 20:00:30
问题 I want to share text in my CardView using share Intent using kotlin but there is a problem with last line in the code in kotlin the code val shareIntent = Intent() shareIntent.action = Intent.ACTION_SEND shareIntent.putExtra(Intent.EXTRA_STREAM, "ali") shareIntent.type = "text/plain" startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))) here is the problem in the code startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to))

Turn on screen on device

我是研究僧i 提交于 2020-01-10 17:51:10
问题 How can I turn the sceen on ? I tried something like this adb -d shell am broadcast -a android.intent.action.SCREEN_ON It really should work, I send broadcast intent it is received by the system, but the screen doesn't turn on I do not understand what is the problem, is it possible to turn the screen of the device by code ? I mean with software ? Cause it seems like the turning on of the screen is done just by the hardware button press . . . at least I got that felling , am I wrong ? 回答1: I

Turn on screen on device

我只是一个虾纸丫 提交于 2020-01-10 17:50:08
问题 How can I turn the sceen on ? I tried something like this adb -d shell am broadcast -a android.intent.action.SCREEN_ON It really should work, I send broadcast intent it is received by the system, but the screen doesn't turn on I do not understand what is the problem, is it possible to turn the screen of the device by code ? I mean with software ? Cause it seems like the turning on of the screen is done just by the hardware button press . . . at least I got that felling , am I wrong ? 回答1: I

What is the purpose of IntentSender?

依然范特西╮ 提交于 2020-01-10 08:09:28
问题 I want to known what is the purpose of the IntentSender class for our application? How do we use it in our application? Are there any good examples, apart from The Android Intent Based APIs: Part Seven – IntentSenders And PendingIntents? 回答1: IntentSender is kind of a level of abstraction or glue class that allows you to Receive broadcast when user selects application in chooser. Example when you use IntentSender : Intent intent = new Intent(Intent.ACTION_SEND) .putExtra(Intent.EXTRA_TEXT,

Unable to solve errors in android?

坚强是说给别人听的谎言 提交于 2020-01-10 05:35:25
问题 I am working on android quiz game. QuestionActivity and EndgameActivity are 2 classes in my game. I want when my game over control transferred to EndgameActivity. For this in QuestionActivty class i add Intent i = new Intent(this, EndgameActivity.class); startActivity(i); finish(); in if(currentGame.isGameOver()) method. But after answering last question when my game over control not tranferring to EndgameActivity and log cat showing following errors. QuestionActivity Class- public class