How do I handle this [closed] - android

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 months ago.
Improve this question
Error on my flutter code regarding a dropdown
Exception has occurred.
_CastError (type 'List' is not a subtype of type 'String?' in type cast)

You are trying to cast list to a string thats why you get _CastError, when you use "[]" in dart, you actually declare a list, so either you need to change type String? selectedPlan to List<String>? selectedPlan or just remove the brackets like String? selectedPlan = 'FIXED DEPOSIT SAVINGS';
And please share code as code next time :)

Related

search text in a website programmatically [closed]

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.

NumberFormatException: Invalid float [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
My error is :
weight = Float.parseFloat(etWeightBMI.getText().toString()); error is (1228): java.lang.NumberFormatException: Invalid float: ""
Before Parsing you should check
if(TextUtils.isEmpty(etWeightBMI.getText().toString()))
{
//do your job
}
etWeightBMI.getText().toString(); returns blank. Thats why you get the NPE.
This line returns null.
etWeightBMI.getText().toString();
Do this with validation like below:
if(etWeightBMI.getText().toString().trim().length()>0){
weight = Float.parseFloat(etWeightBMI.getText().toString());
}

Place data from jsonobject into AutoCompleteTextview [closed]

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);

How to get the answers in String Array (ie) Vector? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
This is my code:
blanks=new EditText(this);
String values =blanks.getText().toString();
answers.put(relative.getId(),answer);
if(answer[0].equals(values)) {
Toast.makeText(this,"Match!", Toast.LENGTH_LONG).show();
}
Your code makes no sense. You crate a new EditText field, and then immediately get the text. But this will always be null.

Why is this line of code giving me an error? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am trying to loop through a vectors elements and trying to find out if a position in the vector is equal to null...
if(_vecForShapes.get(i)!=null)//this line works fine but when it gets to a position where it is null it gives me an error? Any ideas?
{
}
Thanks!
Are you sure that it is get(i) that is null, and not that you have exceeded the number of items in _vecForShapes? It is much more likely that the _vecForShapes.get(i) is throwing an error than the comparison to null.
What type does get(i) return?

Categories

Resources