android-intent

Intent to take video in android

二次信任 提交于 2020-01-01 09:29:06
问题 I need to take video from my application using only front camera. I am using intent to perform this action. Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri); intent.putExtra("android.intent.extra.durationLimit", 30); intent.putExtra("android.intent.extras.CAMERA_FACING", 1); //to open front facing camera startActivityForResult(intent, VIDEO_CAPTURE); When I run the application, I am able to take video using front camera. But

Intent to take video in android

浪尽此生 提交于 2020-01-01 09:29:05
问题 I need to take video from my application using only front camera. I am using intent to perform this action. Intent intent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri); intent.putExtra("android.intent.extra.durationLimit", 30); intent.putExtra("android.intent.extras.CAMERA_FACING", 1); //to open front facing camera startActivityForResult(intent, VIDEO_CAPTURE); When I run the application, I am able to take video using front camera. But

Intent that opens “new calendar event” activity

喜欢而已 提交于 2020-01-01 09:22:19
问题 In my app, I want a functionality to create calendar event. I open "new calendar event" activity like this: Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("title", "Some title"); intent.putExtra("description", "Some description"); intent.putExtra("beginTime", eventStartInMillis); intent.putExtra("endTime", eventEndInMillis); startActivity(intent); It works perfectly on stock Android. On HTC Sense, I have only one issue - end

Send a PDF file as Mail or offer app to directly view the file

别等时光非礼了梦想. 提交于 2020-01-01 08:46:27
问题 my Android 4+ app can create different reports in PDF format. Know I would like to offer the user the option to send the file via mail or to open in any app that can handle PDF files. Currently I use the following code: Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("application/pdf"); Uri uri = Uri.parse("file://" + reportFile.getAbsolutePath()); intent.putExtra(Intent.EXTRA_STREAM, uri); try { startActivity(Intent.createChooser(intent, "Share PDF file")); } catch (Exception

Failing to launch activity due to ClassNotFoundException

北城余情 提交于 2020-01-01 08:25:35
问题 I am trying to launch a new activity using the code: Intent i = new Intent(this, TempLobbyActivity.class); startActivity(i); finish(); When I launch this code I get the following exceptions when executing the Intent constructor. FATAL EXCEPTION: main Process: com.edr.iveflownthat, PID: 1457 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/edr/iveflownthat/TempLobbyActivity; at com.edr.iveflownthat.pages.MainActivity.tryAutoLogin(MainActivity.java:46) at com.edr.iveflownthat.pages

Cost of raising an Intent in android

你。 提交于 2020-01-01 07:34:27
问题 How much performance does it costs to broadcast intents? Is it okay to broadcast multiple per second or are intents expensive? 回答1: Intents are meant to launch different activities within the Android OS or to inform about basic actions. It seems like a bad design pattern to use them otherwise. As they travel between different processes and therefore implement the Parcelable interface, they are not the most light-weight. If you are looking to update different activities at the same time you

Set Auto-Rotate Enabled/Disabled Android

南笙酒味 提交于 2020-01-01 07:04:52
问题 I am working on an Android app, for which I would like the user to be able to press a button which either enables or disables auto-rotate. How can I do this with an Intent? I'd imagine I would somehow need to change ACCELEROMETER_ROTATION to 0 or 1, but I don't know how to do this precisely. I hope maybe one of you guys can help me out! 回答1: You can toggle Rotation ON/OFF using ACCELEROMETER_ROTATION as : if (android.provider.Settings.System.getInt(getContentResolver(),Settings.System

ContentValues put method

让人想犯罪 __ 提交于 2020-01-01 06:48:45
问题 At the db side, checkInTime and checkOutTime are of type TIMESTAMP In my java code also, checkInTime and checkOutTime are of type java.sql.Timestamp For inserting a record into db, i am using this piece of code: 1. ContentValues contentValues=new ContentValues(); 2. contentValues.put(USER_ID, userId); 3. contentValues.put(ROOM_ID, roomId); 4. contentValues.put(CHECK_IN, checkInTime); 5. contentValues.put(CHECK_OUT, checkOutTime); 6. return database.insert(MRM_BOOKING_DETAILS_TABLE, null,

Detect if an outgoing call has been answered

◇◆丶佛笑我妖孽 提交于 2020-01-01 06:05:15
问题 Once ACTION_NEW_OUTGOING_CALL has been broadcasted, I need to capture the following event of the other party answer. Could you advice on how to achieve that please? I know it is possible as the Android dialer app changes the green Android icon to the person's photo exactly when they pick up. UPDATED: I've had a look at the source of the app on Android handling the outgoing calls. I noticed the following method in ContactsUtils : /** * Kick off an intent to initiate a call. */ public static

Invoking Google Map Applications from an Android application to get dirving direction

丶灬走出姿态 提交于 2020-01-01 05:45:11
问题 I need to show the driving direction using external google map application i found this link http://developer.android.com/guide/appendix/g-app-intents.html ,but the below opens the Maps application to the given location Uri uri = Uri.parse("geo:13.070984,80.253639"); Intent in = new Intent(Intent.ACTION_VIEW, uri); startActivity(in); I need to know is there is any way to pass two geo location to get driving direction. 回答1: yes its very easy to show the direction if you have the latitude and