android-intent

Switching Activity to firebase- app shuts down

女生的网名这么多〃 提交于 2020-01-25 18:30:47
问题 I have a problem switching activity when a user would click on a link from MainActivity, the app will just shut down, i am not sure if i have a problem with the project structure or declaring the class correctly and the extends. Basically what i did is try to implement Firebase example project provided on the website into one activity i have in my app, in order to have a way to let members log in, i striped down the initial code provided here and implemented it in my second activity window,

Intent.createChooser for ACTION_VIEW shows default browser only

北战南征 提交于 2020-01-25 17:26:47
问题 I am trying to show a app chooser dialog using Intent.createChooser, that will list all available web browsers in user's phone. I'm using the code below: Intent browserIntent = new Intent(Intent.ACTION_VIEW); browserIntent.setData(Uri.parse(category)); // Create and start the chooser Intent chooser = Intent.createChooser(browserIntent, "Open with..."); pIntent = PendingIntent.getActivity(helperMethodContext, 0, chooser, PendingIntent.FLAG_UPDATE_CURRENT); Log.d("HelperMethods: ", "video chat

Sharing text from app to Email app in android

人走茶凉 提交于 2020-01-25 13:02:24
问题 I have the following code which used to send text from my app to Email: Intent mail = new Intent(Intent.ACTION_VIEW); mail.setClassName("com.google.android.gm","com.google.android.gm.ComposeActivityGmail"); mail.putExtra(Intent.EXTRA_EMAIL, new String[] { }); mail.setData(Uri.parse("")); mail.putExtra(Intent.EXTRA_SUBJECT, "Country Decryption"); mail.setType("plain/text"); mail.putExtra(Intent.EXTRA_TEXT, "my text"); ctx.startActivity(mail); It works , but as you see, it uses Gmail app, how

How to create a shortcut of an app on a SPECIFIC launcher app?

喜你入骨 提交于 2020-01-25 10:54:28
问题 Background I already know how to put a shortcut to an app globally: Intent shortcutIntent=new Intent(); shortcutIntent.setComponent(new ComponentName(packageName,fullPathToActivity)); final Intent putShortCutIntent=new Intent(); putShortcutIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT,shortcutIntent); //... <=preparing putShortcutIntent with some customizations (title, icon,...) putShortcutIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); context.sendBroadcast(putShortcutIntent

How to share Image and text both together on WhatsApp to a specific recipient?

倾然丶 夕夏残阳落幕 提交于 2020-01-25 08:07:55
问题 I am trying to send image and text to whatsapp directly to specific recipient, but only text is send String msg = "Message here"; Uri bitmapUri= Uri.parse(imageUrl); Uri uri = Uri.parse("http://api.whatsapp.com/send?phone="+smsNumber +"&text="+msg); try { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(uri+"?image="+bitmapUri)); startActivity(intent); } catch(Exception e) { Toast.makeText(this, "Error/n" + e.toString(), Toast.LENGTH_SHORT).show(); } 回答1: please visit

How to share Image and text both together on WhatsApp to a specific recipient?

左心房为你撑大大i 提交于 2020-01-25 08:05:09
问题 I am trying to send image and text to whatsapp directly to specific recipient, but only text is send String msg = "Message here"; Uri bitmapUri= Uri.parse(imageUrl); Uri uri = Uri.parse("http://api.whatsapp.com/send?phone="+smsNumber +"&text="+msg); try { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(uri+"?image="+bitmapUri)); startActivity(intent); } catch(Exception e) { Toast.makeText(this, "Error/n" + e.toString(), Toast.LENGTH_SHORT).show(); } 回答1: please visit

How to mail TextView data on button click with Android-Intent?

杀马特。学长 韩版系。学妹 提交于 2020-01-25 05:39:24
问题 I am pretty new to both android and NFC . I am working on an NFC related application as a college project that reads the data from tags and lists them. Although I am able to do so, I am facing problems with intent where I am supposed to mail this list to user on button click. Can someone please tell me where I am going wrong and help with a detailed step-by-step approach. Huge thanks..!! Here's the WebServiceActivity : public class WebServiceActivity extends Activity { Intent intent =

Android: Unable to play video from private path subdirectory using intent

久未见 提交于 2020-01-25 04:15:17
问题 I am able to play video from private path /data/data/com.exmaple.ui/files/final.mp4 this path. But unable to play from subdirectory like /data/data/com.exmaple.ui/files/myVideos/final.mp4, Intent intent = new Intent(Intent.ACTION_VIEW); File playFile = new File("/data/data/com.exmaple.ui/files/myVideos/final.mp4"); intent.setDataAndType(Uri.fromFile(playFile), "video/mp4"); startActivity(intent); File Creation code: String path = getFilesDir().getAbsolutePath(); File dest = new File(path,

Dynamic BroadcastReceiver to Check Online Connectivity

房东的猫 提交于 2020-01-24 21:57:09
问题 I want to dynamically set up a BroadcastReceiver to check whether or not I am online ONLY when my app is running in the foreground. Within my main class, I created an an Intent Filter, a nested BroadcastReceiver Class and finally register/unregister the receiver within the onResume and onPause methods respectively. My question is, is there an an intent ACTION that I can add to my intent filter that checks for online connectivity? If not, how can I create this Dynamic Broadcast Receiver to

How to properly set an android intent with the SHOW_OR_CREATE_CONTACT action?

不打扰是莪最后的温柔 提交于 2020-01-24 20:12:07
问题 I would like to use the internal Contact activity to create a new Contact. Here is the code: Intent i = new Intent(); i.setAction(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT); i.addCategory(Intent.CATEGORY_DEFAULT); i.setData(Uri.fromParts("tel", "12345678", null)); i.putExtra(ContactsContract.Intents.EXTRA_FORCE_CREATE, true); i.putExtra(ContactsContract.CommonDataKinds.Phone.TYPE, ContactsContract.CommonDataKinds.Phone.TYPE_WORK); i.putExtra(ContactsContract.Intents.Insert.EMAIL,