Android :: Callbacks With WebView Component?
Sep 17, 2010
I am doing authentication with a third-party site that's supposed to redirect back to my app with auth token (OAUTH).
I have the callback working properly if I open the 3rd party site in a separate browser process via this.startActivity(new Intent(Intent.ACTION_VIEW, uri));
But, if I embed a WebView component in my layout, and open the url in that, the callback does not work. Webview says "You do not have permission to open myapp://callback?token=...." and quickly refreshes to "Web page not available...temporarily down..."
View 1 Replies
Feb 17, 2010
How can I retrieve the java script function value from a web page loaded withing a webview component?
View 1 Replies
View Related
Feb 25, 2010
Here I update my world to include the canvas size. world.getViewPort().updateViewPortSize(width,height); Is there a better way to do this? Is there a way that I can automatically update my world object without having to manually call it in the setSurfaceSize method but instead call it from My world class? My guess is that I can use some sort of callback, but I don't understand them!
/* Callback invoked when the surface dimensions change. */
public void setSurfaceSize(int width, int height) {
// synchronized to make sure these all change atomically
synchronized (mSurfaceHolder) {
mCanvasWidth = width;
mCanvasHeight = height;
world.getViewPort().updateViewPortSize(width,height); }
View 1 Replies
View Related
Oct 13, 2010
If it must implement with AIDL? And please kindly provide an example. There are several solutions, Does anyone know which is better?
View 1 Replies
View Related
Sep 18, 2010
I have an android application. Based on the current geo location of user, I want to fetch some remote data in background and store it. My implementation is: At specific interval a alarm fires up my service. Service uses an anonymous class to query current location and registers a locationListener callback. On call of onLocationChanged() I initiate the remote data fetch from server.
However once my service is done registering the location listener using anonymos class, it returns as expected; as it doesn't wait for callback to happen before finishing. Since callback takes some time and makes a call when service has already returned, it throws an error saying: java.lang.RuntimeException: Handler{43e82510} sending message to a Handler on a dead thread
Which is quite understandable. One quick workaround for me now is that I can use getLastKnownLocation from locationManager as that doesn't respond back by callback; but what if I do want the latest location right now, in a service and not activity? How can I wait for callback to happen and stop my service from returning.
Also, at what point does lastKnownlocation gets updated? Everytime GPS registers a new location; does it update it? What I want to know is that if it's not latest can it still be closed to latest? As I didn't see an option in android emulator to configure the time period between subsequent updates.
View 1 Replies
View Related
Jul 7, 2010
I'm working on a service for my application whose purpose is to allow easy access to various web services we are running. The service is used to maintain a login state across any applications that want to use it so the user only has to log in once when the service is first started.
What is the best way to go about making the service run asynchronously and call back to the application when it is finished. Currently I am using static classes that extend Thread such as
CODE:.....
And to make it easy to call
CODE:....................
But these functions can only be called by my own application. I want anyone to be able to make a one or two line function call and be able to handle the response easily, preferably in a simple callback method.
I figure it has to be done using Intents to start the Threads, but if I do that I can't pass a callback.
View 2 Replies
View Related
Aug 17, 2010
We are supposed to make UI actions only from the main UI thread. But it is not clear to me if callbacks like LocationUpdateListener (and other callbacks from sensors) are already in the UI thread or they require special care to access the UI components.
View 2 Replies
View Related
Sep 23, 2010
I just switched over from iPhone to Android and am looking for something similar to where in the iPhone SDK, when a class finishes a certain task, it calls delegate methods in objects set as it's delegates.I don't need too many details. I went through the docs and didn't find anything (the closest I got was "broadcast intents" which seem more like iOS notifications).Even if someone can point me to the correct documentation, it would be great.
View 1 Replies
View Related
Oct 12, 2010
There are a lot of Android SDK APIs where callback handlers are registered. For a concrete example, with MediaPlayer you can set an onCompletionListener callback. Will these callbacks be called from the main (UI) thread? If the answer is "it depends", then I'm looking for some general rules for what callbacks will be called from the main thread versus another thread. The SDK documentation doesn't seem to spell it out. (Maybe I missed it) It seems important to know, because if I'm guaranteed main thread callbacks, then I can skip some thread synchronization on data shared between different places in code. If I'm forced to be pessimistic out of ignorance, then I have to write extra synch block code and worry about deadlocks, data integrity, and reduced performance.
View 4 Replies
View Related
Jul 15, 2010
Is there a way to obtain the time zone from the callbacks received
void onLocationChanged(Location location)
using the time information that can be obtained from the location parameter
long Time = location.getTime();
Or if there is another way please provide info!
View 2 Replies
View Related
Aug 3, 2010
I want to get the size of a view that is in my activity but I am not able to get that information in any of the activity lifecycle callbacks (onCreate, onStart, onResume). I'm assuming this is because the views have not been drawn yet. At what point are views drawn and is there a callback I can put my code so I can get the size of the view?
View 2 Replies
View Related
Jun 1, 2010
I was wondering if it's possible to call specific methods defined within the AsynTask class from another class and/or service ?
In my specific case I have a Service playing some sounds, but the sound is selected from a List with available sounds...
When a sounds is selected it is downloaded from my home server, this takes some time (not much, let's say around the 3-4 seconds, the sounds/effects aren't big in size)...
So my problem at the moment is that I have a service to play those sounds, and when I select one I wanted to show a progressdialog... The way (if I understood correctly) is to use an AsyncTask, but the only thing the AsyncTask will do is telling my Service to play a specific sound from my server... So there is no "callback" from the service to the Asynctask...
How can I call a running AsyncTask, which sits in another class, and tell him all work is done and thus he can stop showing the ProgressDialog ? Or am I over-engineering it and there are other ways ?
View 2 Replies
View Related
Nov 16, 2010
I'm new to Java, I'm porting over our Windows Phone 7 library to run on Android. Due to syntax similarities this has been very simple so far. Our library is basically an abstracted http message queue that provides data persistence and integrity on mobile platforms. It only provides asynchronous methods which is a design choice. On WP7 I make use of delegates to call the user supplied callback when an async message has been processed and the servers response received.
To achieve the same thing on Android I've found two ways so far - A simple Java listener interface that contains OnSuccess and OnFailure methods that the user must implement, or using the Android handler class which provides a message queue between threads(http://developer.android.com/reference/android/os/Handler.html).
I've gone with the Handler at this stage as if I'm honest it is the most similar to a C# delegate. It also seems like less work for a user of our library to implement.
Example of some user code to make use of our library:
CODE:.............
Using this the user can create as many different handlers as they'd like, called whatever they'd like, and pass them in as method parameters. Very similar to a delegate...
The reason I'm wondering if I should move to a listener interface is because the more exposure I gain to Java the more it seems that's just how it's done and it's how third parties using our library would expect it to be done.
It's essentially the same process, except each time you wanted to do something different with the server response i.e. You might be fetching different types of data from different endpoints, you're going to have to create a custom class that implements our interface each time, as well as implementing any methods our interface has. Or of course you could have a single monolithic class that all server responses were funneled in to but have fun trying to figure out what to do with each individual response...
View 2 Replies
View Related
Apr 2, 2010
I am developing on a Mac with Eclipse and have the skeleton for an app that implements the standard framework callbacks (onCreate, onDestroy, onPause, etc.). When I set breakpoints in the callbacks the debugger stops and displays a tab that says
"ActivityThread.performLaunchActivity(ActivityThread $ActivityRecord,Intent)line:2477" and in the tab page body there is some red text that says "Source not found" and a button that says
"Edit Source Lookup Path...". I have tried adding several paths via "Edit Source Lookup Path..." but can't see to find the one Eclipse is looking for.
View 1 Replies
View Related
Aug 1, 2010
I just switched over from iPhone to Android and am looking for something similar to where in the iPhone SDK, when a class finishes a certain task, it calls delegate methods in objects set as it's delegates. I don't need too many details. I went through the docs and didn't find anything (the closest I got was "broadcast intents" which seem more like iOS notifications). Even if someone can point me to the correct documentation, it would be great.
View 37 Replies
View Related
Aug 20, 2009
I am putting one spinner and one button using following code. Can some one tell me how can i put some space between it?
View 4 Replies
View Related
Aug 31, 2010
Service Component is used to do some task which can be done without user interaction. But for that we have to run a thread in subclass of the Service. I think we can create a thread in Activity class itself then what is the use of Service component? Why don't we create another thread and write the non interacting code in this thread.
View 10 Replies
View Related
Apr 30, 2010
I have almost completed my Android application so am considering ways of distributing the application. I have seen some applications on Market have free limited/locked version and separate Unlock Key/License Key which unlocks extra functionality. How is this done? Has anyone here done this? If so, how well does it work? I am thinking maybe this is better then having two versions of the same application (i.e Lite and Pro).
View 1 Replies
View Related
Nov 18, 2010
I've created a custom component which works like a lock of a safe. customspinner - Project Hosting on Google Code on picture you see two different objects of my component.
If you need to create UI when user need to choose some element of a list, using this non standard component will be more intresting for user. And it is usefull - user can scroll and find a needed value very quickly.
View 4 Replies
View Related
Jan 11, 2010
A component I have created works fine if I put it in the main project and reference it from any res/layout xml, but when I put it in a project on which the main project depends, I get a ClassNotFoundException in the xml.
Whilst after compiling the interface works fine, it is a pain in the * to design an interface without seeing what I am doing because of the error. Does anyone know how to solve it?
Stacktrace:
CODE:.........................
View 2 Replies
View Related
Jul 9, 2010
I have created a simple class named Panel which extends the SurfaceView class and does some drawing in the onDraw method. When I use it from the code it works fine. For example this works as expected:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new Panel(this)); ....
However when I try adding this component from an xml layout the program crashes:
XML file (main.xml):
<?xml version="1.0" encoding="utf-8"?> <org.anddev.Panel android:id="@+id/panel" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"/>
Code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);....
Error msg: Sorry!
The application Test (process org.anddev) has stopped unexpectedly. Pleas try again.
I can not figure out why the same class works when created in one way and doesn't work when created in another.
View 3 Replies
View Related
Aug 2, 2010
I am trying to integrate VP8 video codec into PV opencore FW in Froyo & test at PV test application level. I have done the following steps, 1. Made a new folder for vp8 @ external/opencore/codecs_v2/omx/ omx_vp8. 2. Made appropriate modifications in the omx_baseclass, omx_common etc. 3. Modified the PV test app (external/opencore/codecs_v2/omx/ omx_testapp) for testing VP8. 4. included the VP8 source code to froyo. 5. Included new oscluuid for VP8 With these modifications, the build is fine. The shared libraries and binaries are creating properly. Also OMX-MasterInit is passing. But the application fails at OMX_GetHandle(). *pHandle is coming as zero. I am using the PV OMX core. I am just adding a new codec which is not supported by PV Opencore and test at PV test_app level.Can you please answer my below queries: 1. Do we need to change the pvplayer.cfg file? Bcoz i am using the PC omx_core itself. 2. Any other changes needs to be done for integrating a new component into Opencore? Please provide you valuable inputs. Let me know if need any additional informations.
View 4 Replies
View Related
Jun 26, 2009
My company is in the process of evaluating if we can add support for Android to our product. I am currently working on porting our existing J2ME library to the Android framework and I have a question regarding our UI component. Right now, we have a custom menu that we allow our developers to bring up on the device. On J2ME, we simply have a single call that the developer makes to enter into the menu and then we handle the rest. On Android, it seems the best way to handle this is an Activity. But I have a few questions regarding this approach including is the really the best way to do something like this? Second, if it is, if there are multiple applications on the device that are using our library, are there going to be conflicts with them all having the same Activity embedded in them? Is it possible to create an Actvity at runtime and use it directly? Would there be any side effects of going about it this way?
View 2 Replies
View Related
Feb 14, 2009
I am working on couple android applications which share a common component. The component has Activities, Service and own AndroidManifest.xml. After research, it seems there is no concept of run time share library among applications in Android. So I am looking for a way to linked the share component with other applications at compile time. Applications which will use the component can come from external, therefore I will only provided the compiled file. I would like to build the component into own apk or jar file, can external application include my jar/apk file into their package and be able to start my activity? Please share your experience and advice.
View 3 Replies
View Related
May 27, 2010
I am looking for a calendar UI. Something like the Calendar UI of the Calendar Android Application but only with the view. (I know that's open source so I can extract the UI but it's a long process to remove all the staff unnecessary) Is there any open source Calendar UI project for android ?
View 2 Replies
View Related
Mar 9, 2010
IN our current project, I need to make a UI describled as follows.
Basically it is a text input, it will display a string returned from server , such as "I like banana". The word "banana" will be in red color. When user clicks "banana", it will have a dropdown list shows "apple, orange, pear". User would be able to select one of them, like apple. So the text in that UI would be "I like apple".
How could I build such a UI component in Android.
View 2 Replies
View Related
Nov 20, 2010
How do i do a if statement but i want like: else if not edittext.getText.toString.contains("hello") then doCode. and how do i setfocus on a component and remove the focus can not really figure that out.
View 2 Replies
View Related
Nov 2, 2009
I want to make Ticker Component but i dont know how to do this. I have seen "Marquee" but it start scroll on focus but i dont want. I want to scroll text if it is focused or not means in both conditions.
View 3 Replies
View Related
Jul 19, 2010
I am trying to get a SharedPreferences object from the PreferenceManager but don't want to pass in the Context to the class.
Can I get a "global" context from inside my class?
CODE:...................
View 1 Replies
View Related
Jun 17, 2009
First of all let me say that i am new to the JNI. However, i gathered some knowledge about it. As i was going through the android_media_MediaPlayer.cpp in ase mediajni to understand the way of operations of the android media framework, i saw the signatures of the JNI functions don't contain JNIEXPORT and JNICALL macros. Have these macros become redundant in JNI 1.4?
View 2 Replies
View Related