I'm trying to build an app in which a user inputs ingredients into multiple text fields displayed within my app. when the user presses enter all of their text is formatted as a Google search, my app would then open the default web-browser on the users phone and display a google search for recipes containing the ingredients that they entered.
So far I've tried the google custom search engine and I've been searching the internet for hours now on how I could go about actually building this. So any input or expertise you may have that could help me would really be appreciated.
you can open an intent with specified URL like this
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(strURL));
startActivity(myIntent);
strURL can be constructed with appending
google.com/search?q=searchstring1+searchstring2
to your search string
EDIT:
text1=editText1.getText(); and so on you can get text from different text inputs
strURL=text1 + "+" + "text2" + "+" + text3;
Just open a browser to https://www.google.com/search?q=term1+term2+term3 where term1, term2, and term3 are the terms you want to search for (and of course you can add more).
Related
I want to create a edit text where user suggestions will be shown when user typed "#" keyword.
For eg. If the selected user is: "James test user".
And if user press delete character(back space in android keyboard.) then it should delete the word by word instead of characters. just like first user will be deleted then test and then james.
Any lead will be great for me.
I've tried the https://github.com/linkedin/Spyglass and https://github.com/hendraanggrian/socialview. But they won't fulfill my requirements.
I develop app in kinetise tool and I found it is possible to easly add list with Google spreadsheet content. But I don't know whether it is possible to edit sheets from user account (when it is public or user sign up with Google). Let's say add records for specific position (A1) in specific sheet (SheetName). How to achieve this?
Yes, you can both view your spreadsheet (read) and edit it (write) in Kinetise.
Firstly, publish your sheet and get public URL address (File -> Publish to web).
Now in Kinetise editor add List widget and select "From Google Sheets" in Online source view. Paste your URL address and data from sheet should be displayed.
What about write, well you need to Sign-In with Google first. So please add Google login method to your application. You can do this attaching Google login widget to your Splash Screen.
Then in screen where you want to edit sheet please add Form widget. Select "To RESTful API" as form send destination. Paste below url:
https://sheets.googleapis.com/v4/spreadsheets/{spreadsheetId}/values/{range}:append?insertDataOption=INSERT_ROWS&valueInputOption=USER_ENTERED&access_token=##GetGoogleUserAccessToken##
where
{spreadsheetId} - yours spreadsheet ID (same as in List widget's URL);
{range} - columns range: A1:B1 (depends on number of columns in your table).
The last thing you have to do is to edit send request body. Please click Settings button on the right of URL address. In Body tab and Request body transform section please paste:
{ "values": [
[ .form.field1, .form.field2 ]
]
}
field1 and field2 are names of form fields, so if you have another names or more columns please change it. And that's all, now you should be able to edit spreadsheet.
I have been wracking my brains but have come up short. https://developer.android.com/training/search/setup.html I am trying to figure out how to find out when the user has clicked on a voice button or for that matter what the user has said. This is independent of what the user types on a searchview. So, the https://developer.android.com/reference/android/widget/SearchView.html#setOnSearchClickListener(android.view.View.OnClickListener).. will not work.
Other than extending the SearchView and putting in my own click listener is there a way for me to find out when the user has clicked on the voice icon?
Just like any search, the result is found in SearchManager.QUERY. However, for voice search, SearchManager.USER_QUERY will be empty as per its documentation:
Intent extra data key: Use this key with content.Intent.getStringExtra() to obtain the query string typed in by the user. This may be different from the value of QUERY if the intent is the result of selecting a suggestion. In that case, QUERY will contain the value of SUGGEST_COLUMN_QUERY for the suggestion, and USER_QUERY will contain the string typed by the user.
Is there any way, through which my android application can interact with a web page that I provide?
For example: I want to retrieve user information from a web based erp-system. So first user needs to log-in with his/her credentials. After that, the student home page opens up. I want to know, suppose that I have the credentials in simple text.
How can I insert, 'click' certain buttons elements of the web-page, in background, without any user intervention. Also, once the homepage loads up, Is there any way through which I can access data from DOM elements?
Simply, I just want to know, is this even possible? All the user interaction taking place in the background? And if yes, can someone just point me in a right direction? I actually don't know how to 'term' this process.
Thank You.
EDIT:
I found out, that the button has an associative function 'logincheck()'. So, by calling this function, same can be achieved, right? Problem is, how the credentials can be inserted in the labels and how this function can be called?
You can manually download the html page on interests and parse it using regex to find out info contained in DOM elements.
Or it s possible to automatize also the login by using for example Python and the request lib to issue HTTP requests and retrieve the pages.
Another option, more graphic oriented is to use JWebUnit lib (for Java) to navigate the pages and login etc
If you are the owner of the webpage or if you have access to it's code, look for division IDs for the form fields that you're trying to fill. Then, in your WebView, once the login page loads, you can fill the form using JavaScript -
Assuming that the username form field has an id 'username' and the password field has an id 'password',
webView.getSettings().setJavaScriptEnabled(true);
String js = "javascript:" +
"document.getElementById('username').value=" + "'" + username + "';" +
"document.getElementById('password').value=" + "'" + password + "';" +
"document.forms[0].submit();";
webView.loadUrl(js);
I have implemented a Twitter search in my android app, when I search for a string I get all tweets associated, but I only want one result showing only the string I'm looking for, not the entire tweets.
For example, if I'm looking for "MTVAwards" I get something like "Hi #MTVAwards, regards from Michigan"... The result I want is "MTVAwards" if exists, if not a button to create it.
I´m only looking for hashtags (#)
Thanks