I have a task to add a custom menu item to Android's built-in email client. This feature shows a custome item, such as "My menu item", in the menu when the user selects an email in the list view. When the user select this custome menu item, my java code should be called and retrieves the email information, such as sender, recipients, subject, body, attachment information, etc. to do custom job.
I am a BlackBerry developer. I can do this easily on BlackBerry. But I am new to Android. I need to know:
How do I add a custome menu item into the existing email client's menu?
How do I retrieve the selected email information in the event process?
Any response is appreciated.
Lawrence
You cannot do this in Android. You cannot alter another application, and even the native e-mail client counts as an application (everything does). Perhaps with a further description of what your menu item is supposed to accomplish, we can suggest a different strategy that fits in with Android.
Related
I have an android app, which lets people share content from other apps to it. When it receives the shared data, it looks for the URL in the shared text and fetches the page and does processing on the data fetched. This is designed with specific purpose and not a generic for all apps.
It works fine, except that people have to click the share icon and then choose our app name. With accessibility we can reduce this work for the users. We are able to get the text displayed in the app.
Is it possible to get the content which we would get if we were to click the share button.
Or
Is it possible to trigger the share button and choose our app without disturbing the user in anyway
You could try that if it's only for 1 specific app. See question How to click button in settings using AccessibilityService? which clicks a button. This will not scale if you want to do this for more apps. You could however parse the text that is on the screen and look for http links and process them in a background service and then show a floating button like Link Bubble Browser
You can simply trigger the share activity of your app when you detect the text from the other app; but the question is how will you know when user is done typing the text?!
One way is you can place a system-wide floating button similar to Facebook Messenger and after user clicks it, the text can be shared. This will reduce number of clicks user has to do.
So,
1) Yes, its possible to get text content via AccessibilityService.
2) No, you cannot automate this action.
Hi i was wondering if it was possible to create a Sidebar for an activity that would allow a user to select a few options such as extra information that can be associated with an object. before sending it off to a server through an API I have looked at trying to use Googles own Nav bar as well as a few Third party libraries that dont seem to want to work for me.
Encase you dont understand what im trying to achieve ill give an example:
Say i have an activity that allows the user to create a log for a specific group within the app now the user may press submit and it will be sent off to the server to be stored in a Database but the user can also associate other aspects to this log such as a book id or an activity ID.
So the user should able to pull a side bar from the side and select any extra information they need (probably from spinners or extendable listview) and then go back to the main activity and submit the log.
Is there anyway of creating anything like what im asking with out having to dig into third party libraries?
You can define arbitrary layout for your NavDrawer (I will use the name of android component here). There is no enforcement to navigation here. So, put in NavDrawer's layout a bunch of controls that you need and define their onClick, onSelected, etc. methods to handle corresponding properties changing. On submitting just get checked/selected/entered info from controls in NavDrawer, augment your data with it and send to server.
I know that user can share the selected text, copy the text into clipboard in order to pass the text to third party application.
But can that be simpler way such that user highlight the text (eg in browser) and then pass the selected text to my app?
If not, may be long click or some other gesture after selecting the text.
What you are looking for would cause a major security hole so I highly doubt you can do that.
The application itself needs to send you the data (e.g. share intent etc), sending selected text could mean an app can snoop on the activities you do on other apps.
Please see the requirement below.
For instance, take Astro browser as a template. You might have seen context menu (with menu options such as Open as, Edit, Details and Send), popping up once an item in the list is selected. I want to implement a similar context menu, with different options, when user taps an email attachment irrespective of email clients. Ideally an option would be 'send via bluetooth', allowing the user to send the attachment straight away.
I looked for suitable APIs. However, there isn't any. This made me think about native programming. I am pretty new to those stuffs.
Could anyone throw some inputs on how to proceed?
Thanks in advance!
I want to implement a similar context menu, with different options, when user taps an email attachment irrespective of email clients.
That is not possible, sorry. You are welcome to implement your own mail client with your own context menu, though.
I would like to create a custom list view like in the Native Email application
When you click the check box you can add a click listner and do a particular action
When you long press it opens the contextual Menu
When you click the list item it performs another function like going to another activity to display that email kind.
If you can point to the code in the Native Email Application.. it would be great too :)
If it is sufficient to post a link to the app you need, here's a link to the source of Email Application.
Other resources you should check out:
Hello Views tutorial
API Demos in the samples folder of Android SDK