android-intent

Sending Image over Viber

前提是你 提交于 2019-12-25 02:38:05
问题 I am trying to send a image through viber or watzapp. Whatsapp works fine but viber always keep telling "The selected file appearers to be unsupported or corrupted. Please select a different File". Any idea what's going wrong ? Here is my code Uri uri = Uri.parse("android.resource://com.example.test/drawable/image_1"); sharingIntent.setType("image/jpg"); sharingIntent.putExtra(Intent.EXTRA_STREAM, uri); startActivity(Intent.createChooser(sharingIntent, "Share image using")); 回答1: int

Android: How to get allowTaskReparenting=“true” to work

不打扰是莪最后的温柔 提交于 2019-12-25 02:37:12
问题 I am writing an app that can be launched from another app by receiving an intent with ACTION_VIEW or ACTION_EDIT. For example, it can be opened by viewing an email attachment. The trouble is that when you click on the home button and click again on the launch icon of the email app you were using, my activity is killed and any user edits that had been made are lost. What I want to happen is that when the user clicks the home button, my activity is re-parented so that it resumes when the user

How to resume previous activity instead of going to default HOME launcher

岁酱吖の 提交于 2019-12-25 02:29:46
问题 I have created a settings activity which will get fired when I press the two volume keys simultaneously. I am invoking this settings activity using an Intent from PhoneWindowManager.java as below, Intent intent = new Intent("com.MyApp.Settings.EXT_SETUP"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mContext.startActivity(intnt); I am also running a custom launcher application. While the custom launcher is running, I am able to invoke my settings Activity by pressing the volume buttons.

Bitmap from service to intent causing RuntimeException receiving broadcast intent

烈酒焚心 提交于 2019-12-25 02:29:46
问题 I'm passing a drawable to bitmap which then gets turned into a bytearray and back again. This however causes an error with onReceive. What am I doing wrong and how may I pass it correctly without breaking the receiver? Error (full here: http://pastebin.com/DtBWK8bc): java.lang.RuntimeException: Error receiving broadcast Intent { act=com.mytest.accessibility.CATCH_NOTIFICATION flg=0x10 (has extras) } in nexter.lpvlock.material.com.accessb.ToastOrNotificationTestActivity$1@b10a35a8 Service:

android - using pending intent to start activity

限于喜欢 提交于 2019-12-25 02:29:45
问题 I have 2 apps App1 and App2. I need to test sending a pending intent from App1 to App2 that allows App2 to start an activity in App1. In App1 (Main Activity): Intent i = new Intent(); i.setClassName("com.android.testapp1.app", "Activity2"); PendingIntent pit = PendingIntent.getActivity(getApplicationContext(), 1, i, 0); Intent intent= new Intent(); intent.setAction("com.android.testapp2.app.activity2_action"); intent.putExtra("pi", pit); startActivity(intent); In App2's Activity2 : Intent i =

How to show chooser Intent with my own android app on click of WhatsApp location?

与世无争的帅哥 提交于 2019-12-25 02:26:19
问题 If there's a WhatsApp chat which has location shared, when clicked it shows a chooser intent with some set of applications. I want to write an intent filter so that my application will also be listed there. 回答1: You can do it by supporting implicit intent to your Activity . Define intent-filter to Activity to which you want to open after clicking to your Application from options. <activity android:name=".BrowserActivitiy" android:label="@string/app_name"> <intent-filter> <action android:name=

The easiest way to pass data between application in Android

放肆的年华 提交于 2019-12-25 02:22:02
问题 What's the easiest way to pass data(string value) between two android applications with less or even without permissions? Also in my case first application sends data to un-existed application which is installing and it can't listen for intent right now. Thanks. 回答1: Your question is tricky when you can't ensure that both applications are running. In cases like that, you must rely on some form of persistent storage. If you're concerned with only a small amount of data, Android provides a

Can I register a BroadcastReceiver in code which is raised by a explicit Intent?

烈酒焚心 提交于 2019-12-25 02:20:24
问题 I've learnt that BroadcastReceiver has to be declare in AndroidManifest.xml or registered in code like this: BroadcastReceiver receiver = new MyBroadcastReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction("some_action"); registerReceiver(receiver, filter); But if I want to use a explicit Intent (which does not have IntentFilter s) to start the BroadcastReceiver , how should I register it in code? 回答1: That is not possible. An explicit Intent will only work with a manifest

No Activity found to handle Intent when the manifest is correct

六眼飞鱼酱① 提交于 2019-12-25 02:09:35
问题 I have been going over this for an hour and I cannot figure out the issue. I am trying to launch a new activity when a boolean value is true inside the ACTION_UP TouchEvent. public boolean onTouchEvent(MotionEvent event) { int eventaction = event.getAction(); int X = (int)event.getX(); int Y = (int)event.getY(); fingerX = X; fingerY = Y; switch (eventaction ) { case MotionEvent.ACTION_DOWN: if (okayButton){ if (fingerX > 323 && fingerX < 423) { largeOkayButton = true; } } break; case

Why doesn't this code attach an image to MMS message?

做~自己de王妃 提交于 2019-12-25 02:09:32
问题 The code is pretty basic share_button.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Uri image = Uri.parse("android.resource://com.mypac.app/" + imageToSend); Intent share = new Intent(Intent.ACTION_SEND); share.setType("image/jpeg"); share.putExtra(Intent.EXTRA_STREAM, image); startActivity(Intent.createChooser(share, "Share with")); } }); The variable imageToSend is int - ID of the image in /drawables directory. In the share dialog, I can see the Messaging