Android :: Looper Doubt

Aug 10, 2010

I have a doubt in Looper. I want to know when we should use Looper. If any good link for more clarification, it would be great.

Android :: Looper doubt


Android :: Better Looper Documentation - Complete Account Of Looper

Jun 23, 2009

Trying to get my head around the specific ins/outs of the Looper object and how it interacts with Threads. Documentation is rather scant on this topic. This is one of those topics that is obvious to the Android core team, but to the rest of us, it's not so obvious.

Can someone point to better documentation or give a more complete account of Looper:

1. What is looper.

2. How does the Android phone use Looper to coordinate message handling?

3. What do I need to do when I get the "Can't create handler inside thread that has not called Looper.prepare()" message?

4. How do I use LocationManager.requestLocationUpdates with Looper, and why does this call require a Looper object?

View 6 Replies View Related

Android :: Content Provider Doubt

Aug 9, 2010

I have a doubt about content provider. Why we use content provider? can't we use database of a application? If we talk about other application also. can't we use database of that application directly wihout content provider?

View 6 Replies View Related

Samsung I7500 :: Touchscreen Unclarities (Eclair Doubt)

Dec 17, 2009

Quote:

View 4 Replies View Related

Android :: Looper - LoopOnce

Jul 14, 2009

I have a thread that does all my rendering code for a game (including animations). I want to be able to communicate with that thread via Messages instead of locking / synchronization. This means that I need to both support a message queue and *also* support my own rendering loop. Normally I would just clear the message queue every frame of rendering so worst case scenario the messages sit on the queue for one frame before getting cleared out. This also gives a bit of priority to messages in that if the queue backs up the rendering will take a back seat until it empties out.

Everything was going fine until I realized that Looper doesn't have a "Clear the Queue" function! I looked at the source code for Looper.loop() and it appears that the code necessary to manually traverse the MessageQueue is protected, so I can't even write the ClearQueue function myself.

Does anyone here have any feedback on how I can have a thread that keeps the MessageQueue clear at the same time as allowing me to peg the CPU rendering as many frames per second as I can?

My current thought is to insert a message into the MessageQueue along the lines of "RenderOneFrame". When this message is popped off the queue I would render one game frame. Before returning from my rendering code though I would push another copy of the RenderOneFrame message back onto the queue. This means any messages added to the queue while I was busy rendering the frame would get processed before the RenderOneFrame mesage and once the queue was "clear" (ie: RenderOneFrame message was back on top) I would repeat the process.

I suspect that this will work, though I am open to suggestions for either a clear or faster method (I'm more interested in clean at this point, but at optimization time I'll be interested in faster if I bottleneck on this code).

View 3 Replies View Related

Android :: Looper - Prepare

Sep 27, 2010

I'm trying to initialize OpenFeint in my game like this:

CODE:...........

Result: 1. OpenFeint initialization sometimes take so song(network actions?). It blocks the main thread. 2. My application remains in onCreate() for too long. 3. My Dev Phone One display ANR(application not responding) dialog prompting me to choose between 'Force Close' and 'Wait' 4. Soon after that, OpenFeint has done its things and my game shows up behind the dialog. 5. Now pressing 'Wait' will dismiss the ANR dialog and I can continue my game properly.

But obviously we don't want ANR dialog. So now I put it in a Thread like this:

CODE:...............

---------------------------------------------------------------------------­-- Result: Problem solved. Everything seems to run fine now.

I put Looper.prepare() there because my game will crash if I don't. The log message told me to put it there. I put Looper.loop(); there because OpenFeint will not initialize at all if I don't. I've read the doc about Looper but honestly I don't understand what the doc says.

Question 1. The doc also tell me this: ------------------------------------------------- public static final void loop ()

Since: API Level 1 Run the message queue in this thread. Be sure to call quit() to end the loop. -------------------------------------------------- Can anyone explain when & where should I call quit()?

Question 2 What will happen if I don't call Looper.quit()?

Question 3 Let me ask this straight. Am I taking the correct approach? Is there some kind of loop running alongside my game all the time if I do this?

View 5 Replies View Related

Android :: Quitting The Looper

May 8, 2010

I have a thread I use to periodically update the data in my Activity. I create the thread and start a looper for using a handler with postDelay(). In onDestroy() for my activity, I call removeCallbacks() on my handler.

Should I then call handler.getLooper().quit()? Or not worry about it and let the OS deal with it? Or would it just run forever then, consuming CPU cycles?

View 2 Replies View Related

HTC Incredible :: Signal Test / Strength Call Quality In Doubt 2nd Phone

May 5, 2010

We originally bought 5 for our business. Of those 5, 2 have been returned and exchanged for Blackberries. We continue to have terrible Signal Strength, and in 2 phones a very loud echo. All other little bugs aside, im looking for some answers. Since I didnt see any side by side tests, I thought I would

1. I tested the signal strength at 5 locations. All locations had great 3g speeds for all the phones. The first INC is an original phone, and the second INC is a replacement.

Droid Eris INC1 INC2
-75 -80 -98 -96
-85 -74 -101 -100...

My question is, how can i have GREAT 3g speeds with all the phones, yet have a terrible signal strength. I'm on my 2nd phone and still have the same issues. ( So its not a bad batch)

2. The first thing the other 2 users of the phones mentioned right out of the box there was a very defined echo. The echo was of their own voice, not the other person on the line. I've noticed it on and off, but nothing to bad. People also complain they can hear the echo, making us hard to hear on the phone. I really like the Incredible, but I guess unless someone from Verizon tells me to wait for an update, or someone here has a solution Im gonna have to go back to the Blackberry. Anyone else having the same problems?....

View 49 Replies View Related

Android :: Communicating With A Looper Thread

Feb 9, 2009

I need a message queue in my background thread, so I created a looper thread.

CODE:...................

View 5 Replies View Related

Android :: Looper - Handler Issue

Oct 10, 2009

I'd like to know if Looper can enable handler to handle one message at a time, instead of handling all the messages in the queue together in one blocking call when Looper.loop() is called.

Because the looper sends all the messages in the queue to the handler one after the other in one blocking call, my application displays the ANR message. Instead, I want to be able to handle one single message, one blocking call at a time - the instant it falls into the queue.

The following code illustrates my problem: (pls note the lines referred: 1,2,3,4&5) Question 1: After calling looper.loop in line3, line4 and 5 don't run. Why is this? I tried quit(), but it doesn't help. Question 2: Instead of displaying 0,1,2,3,4 in one blocking call (at line3), I'd like to have 5 different blocking calls for each. Essentially (sorry, if i sound repetitive), I want to be able to use looper in such a way that each time, it ensures only one message gets handled.

Is there a way to do this?

CODE:..................

View 3 Replies View Related

Android :: Looper Inside An AsyncTask

Oct 27, 2009

I ran into some trouble trying to use a Looper inside an AsyncTask (its doInBackground method). Everything works fine until new Tasks are being created by AsyncTask.sThreadFactory, but once I reach the AsyncTask.CORE_POOL_SIZE limit and AsyncTask begins to recycle the threads, sending messages to my looper (created inside doInBackground) results in a MessageQueue RuntimeException: "sending message to a Handler on a dead thread".

The code I tried was:

CODE:....................

View 4 Replies View Related

Android :: Can't Create Handler Inside Thread That Has Not Called Looper.prepare

Oct 6, 2010

What does the following exception mean? And how can I fix it?
This is the code:Toast toast = Toast.makeText(mContext, 'Somthing', Toast.LENGTH_SHORT);
This is the exception:
D/VVM ( 684): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
D/VVM ( 684): at android.os.Handler.(Handler.java:121)
D/VVM ( 684): at android.widget.Toast.(Toast.java:68)
D/VVM ( 684): at android.widget.Toast.makeText(Toast.java:231)

View 1 Replies View Related

Android :: Calling Looper More Than Once Causes - Sending Message To A Handler On A Dead Thread

Sep 4, 2010

I am using an Executor [fixed thread pool] with my own ThreadFactory that adds a Looper:

CODE:...............

I am running a thread that makes network requests but if the network fails I would like a dialog message to be displayed to the user. This process is rather involving since it requires making AND displaying the request in the UI thread. I can wait for the user's response to the dialog by simply adding a Loop to the network thread and wait for a message to be send from the UI thread. This allows me to encapsulate the network requests in a while(tryAgain) thread. All works well except when the Looper.loop() method is called the second time (after a second network error dialog is displayed) and a message is sent by the dialog (in the UI thread) to the network thread's handler:

CODE:.............

In the AlertDialog instance is an OnClickListener:

CODE:...............

I've checked that the thread is still active with handler.getLooper().getThread().isAlive() which always returns true but it still gives me "sending message to a Handler on a dead thread". How is it that the Message/Handler has decided that the thread is dead? Shouldn't it rely on the .isAlive() method? In the end I am trying to avoid replicating the thread management build into the Android OS .

View 1 Replies View Related

Android :: Android - Can't Handler Inside Thread Not Called Looper Prepare

Sep 30, 2010

I am getting reports of 'Can't create handler inside thread that has not called Looper.prepare()' once I added ScoreNinja to my Android app, and released it to the market. It seems that it isn't happening all the time as the ScoreNinja highscore has lots of entries from users. I have looked on the web for help but there are no clear directions on what to do. I have used the ScoreNinja code exactly as shown on the scoreninja website. BTW If anyone is having problems with ScoreNinja only displaying one score, check to see if the launchmode is not set to 'singleinstance' in your manifest. This fixed it for me!

View 6 Replies View Related

Android :: Android How To Send Data From Server To Android With No Request From Android?

Oct 19, 2010

today i meet the problem.i need technic can control the android machine from server.then i want send data from server to android with no request from android.

View 2 Replies View Related

Android :: Android 1.6 - Android - View - WindowManager$BadTokenException - Unable To Add Window - Token Null Is Not For An Application

Apr 14, 2010

I'm trying to open a dialog window, but every time I try to open it it throws this exception:

CODE:.................

I'm creating it by calling showDialog with the display's id. The onCreateDialog handler logs fine and I can step through it without an issue, but I've attached it since it seems like I'm missing something:

CODE:............

Is there something missing from this? Some questions have talked about having this problem when creating a dialog from onCreate, which happen because the activity isn't created yet, but this is coming from a call from a menu object, and the appContext variable seems like it is correctly populated in the debugger.

View 3 Replies View Related

Android :: Android WebView Not Loading A JavaScript File But Android Browser Loads It Fine

Jun 3, 2010

I'm writing an application which connects to a back office site. The backoffice site contains a whole slew of JavaScript functions, at least 100 times the average site. Unfortunately it does not load them, and causes much of the functionality to not work properly. So I am running a test. I put a page out on my server which loads the FireBugLite javascript text. Its a lot of javascript and perfect to test and see if the Android WebView will load it. The WebView loads nothing, but the browser loads the Firebug Icon. What on earth would make the difference, why can it run in the browser and not in my WebView? Any suggestions.
More background information, in order to get the stinking backoffice application available on a Droid (or any other platform except windows) I needed to trick the bakcoffice application to believe what's accessing the website is Internet Explorer. I do this by modifying the WebView User Agent.Also for this application I've slimmed my landing page, so I could give you the source to offer me aid. package ksc.myKMB;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebSettings;
import android.webkit.WebViewClient;
import android.widget.Toast;
public class myKMB extends Activity {
I already have JavaScript on the web browser on, the problem is the web view is acting to different from the web browser.

View 1 Replies View Related

Android :: Resolve The Error - Com.android Internal R Cannot Be Resolved - Using Android File MultiAutoCompleteTextView.java

Aug 15, 2010

I want to implement my own Tokenizer base on the file
"MultiAutoCompleteTextView.java",

but I encounter an error "com.android.internal.R cannot be resolved" when I try to

import "MultiAutoCompleteTextView.java" to my project.

code:.................

I haven't research any solutions to resolve this problem.How to correct "com.android.internal.R.attr.autoCompleteTextViewStyle" my own attr?

View 1 Replies View Related

Android :: Does Android Eclair Code Base Support Plugins In Android Browser?

Jan 11, 2010

1- Does Android Browser (Éclair code base) support the "plug-in" or not?

2- Why "Google Gears" support is removed from the clair code base?

I searched the forum and came to know that earlier version of the Android does not support it at all? Here is the link for that, but this query asked in Dec'2008.

View 2 Replies View Related

Android :: Android How To Edit Specific Record From Database In Android Programming

Jan 5, 2010

At first,I have a database created by using Ruby on rails.I just already implement insert function(HTTPPost) in my Android Application and it's work.But I don't know how to retrieve specific record from my databases and insert it back to specific record in Android (Like edit function in RoR)This is my insert code :
private void insertComment() {DefaultHttpClient client = new DefaultHttpClient();HttpPost post = new HttpPost("http://10.10.3.87:3000/comments");
// Configure the form parameters
List<NameValuePair> nvps = new ArrayList<NameValuePair>();
nvps.add(new BasicNameValuePair("comment[content]", t_comment.getText().toString();
nvps.add(new BasicNameValuePair("comment[id_account]", "1"));
nvps.add(new BasicNameValuePair("comment[id_place]", Integer.toString(position)I really try many ways out but it doesn't work and it takes very long time to fight with this piece of code. Actually, I really don't know how to specify RowID to HTTPPost.

View 2 Replies View Related

Android :: Android.. How To Upload Data From Android Phone To Remote Database?

Sep 17, 2010

I am doing some android development, and now I need to send some android application generated data onto a remote server (a database)?How can I do that? can I use direct JDBC connection and sql?

View 1 Replies View Related

Android :: Sending Info From Android Phone To An Computer IP With Android Emulator

Oct 9, 2010

So i am making a android app, and i want it to be so if i call lets say 911 it sends my GPS coordinents to a certain IP, i know everything but how i make it so if i call 911 it sends the info and how i can make it send the info to the IP via 3g,

View 3 Replies View Related

Android :: Android Market Hiding Apps With Bluetooth Permissions From Android 1.5 And 1.6

Jul 10, 2010

I released updates of my apps yesterday and they are being hidden from android 1.5 and 1.6 phones.

This is due to a Market bug which hides apps with bluetooth permissions from android 1.5 and 1.6.

Come on Google fix the market. We spend countless hours making are apps work on ALL android versions and now you do this...

This issue has been raised since June, but has only affected me since i made an update to the market yesterday.

View 1 Replies View Related

Android :: Mock And Performance Tests Available In Android For Testing Android Application

Dec 23, 2009

What exactly are mock tests... I need to know the mock and performance tests available in android for testing android apps..what is the best tool for testing android apps and how..

View 1 Replies View Related

Android :: Android - Add Menu Item To Android's Built-in Apps

Aug 17, 2009

I'd like to add a menu option to the Android camera app. Is this possible to do using the current SDK? I know I need to add an intent-filter tag in my activity. But I don't know what I should put in the mime type. I want to be able to process the live camera previews if the user selects the menu option. So what do I put into the type tag of the intent-filter? Also I suppose I won't be using ALTERNATIVE or SELECTED-ALTERNATIVE for the category as I want to deal with the whole intent?

View 3 Replies View Related

Android :: Does The Android Market Check Installed Android's Version ?

Jan 21, 2010

I was wondering if the market checks if the application can be installed on the device. For example, if I have an Android 1.6 and if I try to install an application with :"<uses-sdk android:minSdkVersion="7" />" on its manifest. What will happend ?

View 4 Replies View Related

Android :: Android IRC Office Hours - Android Bluetooth RSSI

Jan 27, 2010

I have a question about bluetooth RSSI functionality on the Android (either 2.0 or 2.1):

It's easy enough to get the RSSI value when a bluetooth connection is created, but how can you repeatedly get the RSSI value of a connection that is already active? It's really important to be able to do this, because this lets you determine if bluetooth devices are close to each other or far away, but I can't find any appropriate function calls in the Android API.

View 2 Replies View Related

Android :: Moto Android Stuck On Android Splash Screen

Feb 5, 2010

I am having a bit of a problem with my Android. So what happened was I downloaded "DroidRootPro" from the market. I rooted my phone with this, installed the 800MHZ ROM image, rebooted and the phone came up great. I was actually surprised on how fast it became. Once the phone came back up, I tried installing one of the custom themes that came with that app (I know I should have left it alone). The phone than rebooted and I was never able to bring it back up. It gets stuck in this endless loop where it tries to boot but doesn�t get past the "Droid" splash screen, it just keeps rebooting every time.

Things I have tried:

-Wipe data/factory reset (in recovery mode), no go.
-Wipe cach partition, no go
-Restore from a "nandroid" backup, no go. I tried pretty much every combination of restores and am unable to bring the phone up.

Is there anyway I can download the factory image that comes with the phone, put it on an SD card and restore to that? I have looked all over but cant find any information on this.

View 1 Replies View Related

Android :: How To Reference R.java Of Other Apps In Android - Like Com.android.music

Sep 29, 2010

I am trying to develop an app to supplement the built-in music player. I've used git to download the com.android.music package and looked around at its code. I can launch the music player by copying some of its code and launching activities with intents.

Now what I need to do is get a handle to its current view. In the MusicUtils.java file, I see a line that says

View nowPlayingView = a.findViewById(R.id.nowplaying);

I'd like to do the same thing. Only I don't have access to the R.java file, so I can't write e.g. R.id.nowplaying. How do I do this? How do I reference the music players R.java? I do know the R.java stuff is declared public so that shouldn't be a problem. Right?

Is it even possible? I saw this related question and am now wondering: http://stackoverflow.com/questions/2437271/how-to-load-com-android-music-code-into-eclipse-and-compile

I'm working against the Android 2.2 SDK, but it'd be helpful to know if the answer is different for older versions such as 1.5.

View 2 Replies View Related

Android :: How To Write Android.mk For An Application Using Com.google.android.maps.jar

Aug 26, 2010

I am developing an application using com.google.android.maps.jar It is OK to develop it with Eclipse SDK. but an build-error happens when building system.img with GMS licence (com.google.android.maps.jar is already installed at out/target/common/ obj/JAVA_LIBRARIES/com.google.android.maps.jar_intermediates/ com.google.android.maps.jar)

make: *** No rule to make target `out/target/common/obj/JAVA_LIBRARIES/ com.google.android.maps.jar_intermediates/javalib.jar', needed by `out/ target/common/obj/APPS/LifeStory_intermediates/classes-full- debug.jar'. Stop.

Here is my Android.mk

CODE:.............

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved