|
Any other method except Toast. Because toast doesn't have close or OK button like pop up message box.
|
|
|
|
|
In that case use a Dialog[^]. But in future you should provide a bit more detail to your questions.
|
|
|
|
|
pankaj788 wrote: How can we display the pop up message of some activity? but that activity must have in onPause() state. What does implementing the onPause() method have to do with displaying a message?
pankaj788 wrote: ...smiler like flash message had been displayed on our front screen. What is a "flash message?"
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
How save spinner data using sharedPreferences and How that data load in that spinner after reopening of the activity?
|
|
|
|
|
pankaj788 wrote: How save spinner data using sharedPreferences... Assuming you already have the data from the spinner, try:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
Editor editor = prefs.edit();
editor.putString(key, value_obtained_from_spinner);
editor.commit();
pankaj788 wrote: ...How that data load in that spinner after reopening of the activity? In onCreate() , onStart() , or onResume() , you'll need something like:
String value = prefs.getString(key);
int pos = adapter_tied_to_spinner.getPosition(value);
spinner.setSelection(pos);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I have used the above code in my activity but nothing append anything.
Can you give me the activity? Cause I am new in Android.
And
What is "key, value_obtained_from_spinner"? Cause I have created the the spinner programmatically.
modified 18-Feb-15 12:21pm.
|
|
|
|
|
pankaj788 wrote: Can you give me the activity? I don't have an activity. I just pulled that code off the top of my head.
pankaj788 wrote: What is "key, value_obtained_from_spinner"? See here.
pankaj788 wrote: Cause I have created the the spinner programmatically. Any reason why?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I have seen multiple solutions to let a Service / Activity communicate each other. However I can't understand in which context we should use them and why.
From what I've read around (android documentation and stackoverflow), these are the main approaches:
- Bind to the service using bindService()
- Use a messenger (it should be for IPC, but somebody uses it for same process communication)
- Static instance (singleton) of the Service. This method could bring errors, what happens if the service dies? Null reference of that service. Shouldn't be better the first approach then this one?
- Use LocalBroadcastManager and register the Activity for receiving. Basically, the Activity listen to the broadcasts sent by the Service. Viceversa, the Service in its onStartCommand dispatch intent actions sent from the Activity (explicit intent with custom action). For dispatching actions in the service, another solution could be intent filters on the service and implicit intents (android documentation says NO in the notes, even if I declare custom actions). How many chances are that someone else uses the same custom actions as mine?
- Otto API
Now I'm really confused. Could somebody explain (if possible with examples) why and in which context we should use those approaches?
Are there other solutions other than the ones in this list?
Thank you.
modified 13-Feb-15 10:51am.
|
|
|
|
|
I have and app which requires sending emails with attachments.
This app contains many activities. Within one activity, I send an email using the following intent:
startActivityForResult(Intent.createChooser(emailIntent, "Email"), EMAIL_REQUEST);
This works fine. The email is sent.
The problem:
After email is sent, the app loads/goes to the startup activity, not the activity from which the email was sent.
(Also note: onActivityResult is never called)
How can I return to the activity which sent the email?
Code fragment:
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{to});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(Intent.EXTRA_TEXT, message);
emailIntent.setType("message/rfc822");
File publicFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File inFile = new File(publicFolder, "snapshot.PNG");
if (inFile.exists() && inFile.canRead()) {
Uri uri = Uri.fromFile(inFile);
emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
try { startActivityForResult(Intent.createChooser(emailIntent, "Choose an Email client :"), EMAIL_REQUEST);
isSuccess = true;
}
catch (Exception e) {
Toast.makeText(getApplicationContext(), "startActivity() exception thrown while sending email", Toast.LENGTH_SHORT).show();
}
}
modified 13-Feb-15 11:19am.
|
|
|
|
|
You need to edit your question and show a bit more of the code and indicate exactly where the problem occurs. Please ensure that you use <pre lang="java"></pre> tags around your code, so it is readable like:
startActivityForResult(Intent.createChooser(emailIntent, "Email"), EMAIL_REQUEST);
|
|
|
|
|
What are you doing in the onActivityResult() method?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
I have found a solution.
The initial activity's onresume method is called after the email is sent. What I do is intercept it and perform a startactivity to load the activity which was responsible for sending the email.
|
|
|
|
|
Without further investigation, that sounds more like a workaround than a solution. I have an app that sends an email, and it requires no special code to return right where it was prior to sending the email.
Unless your app is doing something at the same time the email is being composed/sent, have you tried using startActivity() instead of startActivityForResult() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
yes, I did try startActivity. Same effect.
|
|
|
|
|
Dear Experts, Technology God:
I have got a very challenge and difficulty requirement from my customer about Android Phone QR Code scanning function:
My customer wants below functions with Android Phone QR Code(two-dimension code) scanning:
1) First, when customer using Android Phone to scan one QR code( we can call this QR code A), it will pop up one window with one website link, so the customer can double click the link to jump to the Internet website(we can call this website A)
(This function is easy and already done by us)
2) Close after step 1, when the customer open website A with mobile phone Internet Explorer , this website A will automatic add one favorite bookmark to the mobile phone Internet Explorer so the customer can quick access to the website again
3) When customer using Android Phone to scan another QR code ( we can call this QR code B), it will pop up another window with another website link so the customer can click to jump to the Internet website B!
But here is tricky and challenge point:
The customer also want the website B can add one favorite bookmark to the mobile phone Internet Explorer ,but the same favorite bookmark as website A!!
This means the favorite bookmark will be same as one Navigation page and will store all the QR code website quick link!!
4) The customer also want all the QR code related link ,like the website A and website B above show can be read offline , means even Android Phone out of wifi or network connection , the customer can still access and read all the content of the website A and B by click the quick link on favorite bookmark of mobile phone Internet Explorer!
Based on my development knowledge and experience ,for the below requirement 2),3),4), it will need collaboration with mobile phone Internet Explorer supplier ,need mobile phone Internet Explorer supplier open some interface and embedding into some code with mobile phone Internet Explorer! And we also need consider the cost involved since there are different mobile phone Internet Explorer users are using on the Android Phone! It is very hard to collaboration with different mobile phone Internet Explorer supplier!
So I’d like to ask help from all the Experts, Technology God here, is there any possibilities to using one simple way to realize the above requirement, especially for requirement 2),3),4)?
Means is there any possibilities we can realize cross mobile phone Internet Explorer platform or bypass the Internet Explorer?
Great thanks in advance to all the experts who will provide any suggestions!
And if anyone who will provide solutions ultimately solve this problem ,we promise will send you some China traditional gift to you via international express for free!
Thanks again!
|
|
|
|
|
Trying to create an app, need some help
I am trying to create an android app that uses gmap. I want the user to be able to select predetermined starting and ending points and then be given directions between the two points. This is what i have come up with, but the map seems to be frozen and is not actually locating the points or giving directions. Where is my error?
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LuxuryLodgesNZ</title>
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0">
<meta name="apple-touch-fullscreen" content="YES">
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="apple-touch-icon" href="icon.png">
</head>
<body>
<meta name="viewport" content="initial-scale=1.0, user-scalable=yes">
<meta charset="utf-8">
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script><script src="https://maps.gstatic.com/maps-api-v3/api/js/19/7a/main.js"></script>
<script>
var directionsDisplay;
var directionsService = new google.maps.DirectionsService();
function initialize() {
directionsDisplay = new google.maps.DirectionsRenderer();
var Auckland = new google.maps.LatLng(-37.008222, 174.785025);
var mapOptions = {
zoom: 7,
center: new google.maps.LatLng(-37.008222, 174.785025)
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
directionsDisplay.setMap(map);
directionsDisplay.setPanel(document.getElementById('directions-panel'));
var control = document.getElementById('control');
control.style.display = 'block';
map.controls[google.maps.ControlPosition.TOP_CENTER].push(control);
}
function calcRoute() {
var start = document.getElementById('start').value;
var end = document.getElementById('end').value;
var request = {
origin:start,
destination:end,
travelMode: google.maps.TravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<div id="control" style="height: 70px; overflow: hidden; top: 5px; margin-left: 0px; z-index: 5; border: 1px solid rgb(153, 153, 153); display: block; position: relative; background-color: rgb(5, 5, 5);"> <select id="start" onchange="calcRoute();"><option value="Auckland Airport Ray Emery Drive">Start
<option value="41 towey st,oamaru">Pen-y-bryn lodge
<option value="224 Rhodes Rd, Christchurch">Otahuna Lodge
<option value="11075 West Coast Hwy 73, Cass,Christchurch">Grasmere Lodge
<option value="444 Wentworth Valley Road,Whangamata">Bushland Park Lodge
<option value="214 Kawaha Point Rd,Kawaha Point,Rotorua">Peppers on the Point
<option value="Western Lake road,Wellington">Wharekauhau Lodge
</select>
<select id="end" onchange="calcRoute();"><option value="Auckland Airport
Ray Emery Drive">Destination
<option value="41 towey st,oamaru">Pen-y-bryn lodge
<option value="11075 West Coast Hwy 73, Cass,Christchurch">Grasmere Lodge
<option value="Hapuku Lodge, station Rd,Kaikoura 7371">Hapuku Lodge
<option value="3256 Motueka Valley Highway Stanley Brook, Nelson">Stonefly Lodge
<option value="Western Lake road,Wellington">Wharekauhau Lodge
</select></div>
<div id="map-canvas" style="position: relative; height: 300px; border: 1px solid;"><div style="overflow: hidden;"></div></div>
<div id="directions-panel" style="position: relative; top 350px; border: 1px solid; color: rgb(3, 3, 3); background-color: rgb(247, 247, 247);"></div></body></html>
|
|
|
|
|
What exactly does this have to do with Android development?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
bonsoir ,
l'hors d'installation des pachakges android une fenetre s'affiche
"Failed to rename directory E:\adt-bundle-windows-x86_64-20140702\sdk\tools to E:\adt-bundle-windows-x86_64-20140702\sdk\temp\ToolPackage.old01."
merci de me guider
|
|
|
|
|
Please post your question in English only.
|
|
|
|
|
Can you please help how to retrieve and display image from a remote sqlserver db to android app ?
|
|
|
|
|
Help how? You need to explain exactly where you are stuck with this problem. If you have not even started yet, then I suggest you go to http://www.codeproject.com/KB/android/[^] and read some of the excellent articles there.
|
|
|
|
|
I suggest you break your inquiry into smaller, more manageable parts, like:
1) Are you able to communicate with the remote system?
2) Are you able to connect to the remote db?
3) Are you able to display images?
Get each of those up and running, and the project as a whole should start coming together.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Can you help me to find some reference project making mobile commerce android application based web server.. Anything you can share would be used.. thanks..
|
|
|
|
|
That is a question for Google.
|
|
|
|
|
Guys i want to dial a code on button press
i.e. Check screenshot
when i will click on "New Button" it should show a pop up asking "How Much AMOUNT u want to transfer,
after enter amount
it should dial *123*03401234567*AMOUNT# USSD Code
please can anyone help?
http://i.imgur.com/z9s4WIG.png
|
|
|
|
|