How to make a special call and get result in android? [closed] - android

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

Related

how to get random string value from list - android [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 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)

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.

How can i display time as '5 minute ago', 'yesterday' etc in android [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 9 years ago.
Improve this question
I have stored time in milliseconds in android SQLite database. Now, I want to display it as messaging application displays time e.g. '5 minute ago' etc. How can I do that?
use following code:
private String calculateRelativeTime(long time) {
String relativetime = DateUtils.getRelativeTimeSpanString(time).toString();
return relativetime;
}
Try this: DateUtils.getRelativeTimeSpanString(long time, long now, long minResolution, int flags)

HttpResponse & string android [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 9 years ago.
Improve this question
I wrote a code..There I want to validate something.In my code contain "HttpResponse response;" variable.I want to write,
if(response>="0"){
//do somthing
}
but can't above thing. bcs response is not string...How to do that?
EntityUtils is static helpers for dealing with entities.
http://www.developer.android.com/reference/org/apache/http/util/EntityUtils.html‎
String result = EntityUtils.toString(response);
if(result >="0"){
//do somthing
}
response.toString()
try that, you should also look at writing your questions more formally.

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.

Categories

Resources