Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
i want my app to search a specific website(from an url) for a specific text and give me the 3 chars after that text or to search for a pattern with a placeholder and give me the first matching string. Is that possible? There is no need to display the website.
Once you download the page using something like HTTPUrlConnection, you can use a regex with your search term
Pattern p = Pattern.compile("specific text(\w\w\w)");
Matcher m = p.matcher(site_text);
boolean b = m.matches();
The three \w will be captured in a group for you to use if there's a match.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a few youtube API keys for my android project.
eg :
YOUTUBE_API_KEY1 = XXXXXXXXXXX
YOUTUBE_API_KEY2 = BBBBBBBBBBB
YOUTUBE_API_KEY3 = NNNNNNNNNNN
and I want that my String YOUTUBE_API_KEY = random key from the keys list.
how can I do it?
thanks
Use Random Class to get Random value
Java.util.Random
Get Random index value from list and use it.
index = new Random().nextInt(list.size())
item = list.get(index)
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to generate Search Suggestions that matches the input in the AutoCompleteTextView.
It will check for the matches for the first word I type then all the related words should be populated.
After I type next character then it will match combination of that word and populate the result .
I do not understand how to do pattern matches.
For example: Suppose, there are three country names.
INDIA, IRAQ, IRAN.
When I type I then I want get All Country names Starting with I to be displayed.
When I type IR then result should be IRAN,IRAQ. ETC.
Your requirement will be satisfied in AutoCompleteTextView itself.
Threshold is used to set from the length where auto complete show it's suggestion:
For ex:
String[] languages={"INDIA", "IRAQ","IRAN"};
AutoCompleteTextView text(AutoCompleteTextView) findViewById(R.id.autoCompleteTextView1);
ArrayAdapter adapter = new ArrayAdapter(this,android.R.layout.simple_list_item_1,languages);
text.setAdapter(adapter);
text.setThreshold(1);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to get data from http://schedule.sumdu.edu.ua/index/json?method=getTeachers, parse it and load into AutoCompleteTextview. Any suggestions?
You need to access the service URL using an AsyncTask<>, then later on get its response into a String object.
And, parse it, using JSONObject/Json Array present in android. You will get many examples for this.
Later on you can create a String array, load your data in it, and set it for auto complete for text view.
Here is an example for this.
String[] listTeachers; // initialize this with teachers JSON data
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
R.layout.layout_teacher_list, listTeachers);
tvTeacher.setAdapter(adapter);
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
Hello I'm a beginner in Android programming.
I'm working on a graphic calculator but i still have the problem of converting the function to math
For example :
y=cos(x^2)-ln(x)
should look like
y=Math.cos(x*x) - Math.log(x)
And than we plot it.
Thank You
I assume you want to convert a String to a float or double?
String input = "3.14";
float x = Float.parseFloat(input);
This code converts the String "3.14" into a float. You can use this float in the function you described in the question.
EDIT:
If you want to convert the full function String into Java code, you should limit the input to buttons. For example, add a button named "Cos", and remember in the code the user wants to use the Cosinus function. Then the user enters a value, and presses "Enter". The code knows it should use the cosinus function, and x is the value entered in an EditText. That value should be parsed using Float.parseFloat().
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I want to dial a special number like
*123#
which is a network request and get result sent by network.
Is this possible? How can I do it?
Yes you can do this:
Intent calling=new Intent(Intent.ACTION_CALL);
if ( phno.contains( "#" ))
phno = Uri.encode(phno+"#");
calling.setData(Uri.parse("tel:"+( phno ) ) );
startActivity(calli);
Note:
Here phno is String that contains phone number like *123# or 123456789