Android :: Calling An InputMethod Method When A BroadcastReceiver Gets Called

Feb 19, 2010

I added a BroadCastReceiver to my application.I want to call my inputMethod's method but I can't find a way to access it's instance.but I couldn't find a way to get the the InputMethod instance from the InputMethodManager.Is doing a singleton the only way to access it?

Android :: Calling an inputMethod method when a BroadcastReceiver gets called


Android :: Calling Background Service From BroadcastReceiver

May 24, 2010

I am trying to call a push notification background service from BroadcastReceiver class, but my application crashes.When I call this service through an Activity it's working, but my goal is to call this service from a BroadcastReceiver.

View 2 Replies View Related

Android : Can I Initiate Threads In BroadcastReceiver's OnReceive Method?

Dec 18, 2009

My application has two components,one is Activity and BroadcastReceiver. I am using the BroadcastReceiver as inner class of my Application. The BroadcastReceiver's onReceive method is initiating a new Thread as Thread object,every time. In that i am trying to update the activity if it is in fore ground.If it is in back ground i am simply ignoring. But some times my application is hanging as my application's "HeapWorker" thread is taking 80-90% of the CPU.

View 2 Replies View Related

Android : Start Activity From Within OnReceive Method Of BroadcastReceiver?

Feb 3, 2009

I am trying to get a UI to present itself when an incoming SMS happens. When that happens, I would like to present a UI to the user.

I have a BroadcastReceiver class that listens to the SMS_RECEIVED event. I also have an Activity class that is capable of displaying the needed UI when the event happens.

The questions is: How do I start the activity from within the onReceive method of BroadcastReceiver?

I know others have done this but I can't seem to find any resources that illustrates how.

View 3 Replies View Related

Android :: Android 1.5 - Asynctask DoInBackground Not Called / Method Called

Oct 26, 2010

I am running into an issue with the way my asynctasks are executed. Here's the problem code:

firstTask = new background().new FirstTask(context);
if(firstTask.execute().get().toString().equals("1"))
secondTask = new background().new SecondTask(context);

What I'm doing here is creating a new asynctask object, assigning it to firstTask and then executing it. I then want to fire off a separate asynctask when the first one is done and making sure it returns a success value (1 in this case). This works perfectly on Android 2.0 and up. However, I am testing with Android 1.5 and problems start popping up. The code above will run the first asynctask but doInBackground() is never called despite onPreExecute() being called. If I am to execute the first task without the get() method, doInBackground() is called and everything works as expected. Except now I do not have a way to determine if the first task completed successfully so that I can tell the second task to execute. Is it safe to assume that this is a bug with asynctask on Android 1.5? Especially since the API says that the get method has been implemented since API 3. Is there any way to fix this? Or another way to determine that the first task has finished?

View 2 Replies View Related

Android :: Shouldn't Calling FinishActivity Cause Finish To Be Called?

Nov 11, 2010

I have overridden the finish call in a sub-activity like so

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

I am calling finishActivity on this sub-Activity from the Activity that started it for result. But I am not seeing the finish being hit. Instead it goes directly to onPause.

View 2 Replies View Related

Android :: Method Called After Release

Sep 22, 2010

I'm getting this error ( in the end of this post) which I guess I understand it's because I'm calling something after releasing it.. but I can't find a wy to work it around.I've tried all combinations.. I've tried: mCamera.setPreviewCallback(null); This class, where the surfaceview is implemented can be accessed by 2 different classes one that doesnt implement surfaceview and other that does the error just shows me when I go from the activity that uses the camera to the activity that also uses camera.I don't know what else to do.

View 4 Replies View Related

Android :: Is OnUpgrade Method Ever Called?

Jul 2, 2010

Is the onUpgrade method of SQLiteOpenHelper ever called? If so, when is it called and by what? Or if it is not called by developers, then why is it there? What should be done in the method I have seen examples where it drops all the tables, but then a comment says that dropping all the tables is NOT what you should do.

View 1 Replies View Related

Android :: GetView Method Used And Where Is It Getting Called?

Sep 1, 2010

I am new to Android development and have been following the tutorials available on the Android website. I am currently on the section of tutorials for Views, specifically the one for Grid Views: Hello, Grid View Tutorial.I am having trouble understanding how views are made through an adapter. I understand that you must override the getView() method in your adapter class and in this method is where you define how your Views are set up. What I don't understand is where does getView() actually get called? Perhaps I've got the wrong kind of mentality here, but in the code below (the Grid View tutorial) I don't see any calls to getView() (or any other things used in the adapter class such as getCount()).

View 1 Replies View Related

Android :: OnRestart Method Not Called On Restart

Apr 15, 2010

I'm writing a Tetris application on Android for my bachelor thesis at the University of Hasselt. Currently I have a working Tetris base game, but it just keeps on ticking when the activity gets in the background. I'm trying to fix this by overwriting the onStop()and onRestart()methods.when I press my home button on my device I will go to my home screen and onStop() is called. Because the gamemode is now "PAUSE", the game wil not tick anymore. But now, when I longpress my home button and select my tetris activity again, the activity pops up, but it isn't ticking! This is because the onRestart() is never called when I return to play my application.What is the reason that this method is never called? Am I understanding the activity lifecycle wrong?

View 3 Replies View Related

Android :: OnServiceConnected Never Called After BindService Method

Mar 21, 2010

a service started by a broadcast receiver starts an activity. I want to make it possible for this activity to communicate back to the service. I have chosen to use AIDL to make it possible. Everything seems works good except for bindService() method called in onCreate() of the activity. bindService(), in fact, throws a null pointer exception because onServiceConnected() is never called while onBind() method of the service is. Anyway bindService() returns true.The service is obviously active because it starts the activity.I know that calling an activity from a service could sound strange, but unfortunately this is the only way to have speech recognition in a service.

View 4 Replies View Related

Android :: Stopping Method To Be Called Twice If Already Running

Mar 3, 2010

I'm trying to prevent my application to call the same method twice in the event of a double-click, or if the user presses different buttons quickly, almost at the same time.I have clickable Views, acting as buttons, that call the same method but passing different parameters.Inside this method I'm creating a new Thread, because it queries a web server for the result.The problem is that upon two quick clicks, the method is fired twice, two threads are created, and consequently two new activities are created. That makes my app crash.But this only seems to work on slower phones like the G1, I tried on Nexus and before it set blocked = true, the second request has was granted. So is there any way I can block the method being called if it's already running, or if the thread has started so it wont create a new one.

View 3 Replies View Related

Android :: How To Find What Hook / Method Is Being Called In Framework?

Mar 5, 2010

I was wondering how should I proceed to debug while working with frameworks. Like specifically how can i tell which method is being called when a particular event happens.

View 2 Replies View Related

Android :: Extended SurfaceView's OnDraw Method Never Called

Apr 21, 2010

I'm trying to modify the SurfaceView I use for doing a camera preview in order to display an overlaying square. However, the onDraw method of the extended SurfaceView is never called.

View 3 Replies View Related

Android :: Which Method Is Called When Press Back Key On Phone?

Nov 24, 2010

i have an app that haves a lot of activitys, all created with ONACTIVITYRESULT.which method is called when i press back key? i need to know it because i have to override/implement code on it

View 2 Replies View Related

Android :: Calling ListView.setSelection Has No Effect When Called Directly After Adapter Data Was Invalidated

May 4, 2009

I have a ListView whose position should be changed automatically along with the data. So, when the adapter's data has changed (adapter is calling notifyDataSetInvalidated), I'm calling setSelection. This has no effect. If the call to setSelection is done later (e.g. in a click handler) it is working.

The second problem is, that the ListView maintains the scroll position of the list although the data is completely invalidated, that makes no sense IMO.

It looks like a call to layoutChildren before the call to setSelection does help in this case, but layoutChildren is protected.

What is the correct way to do this?

View 2 Replies View Related

Android :: Is It Normal For OnCreate Method To Be Called Multiple Times?

Aug 27, 2010

I have some code in the onCreate method an Activity and noticed that it is being called three times. Is it normal behaviour?

View 1 Replies View Related

Android :: Calling Method From Service Immediately

Sep 3, 2010

I'm pretty sure that android services are going to be the end of me.I have almost no hair left after the last few days.At first I was having a heck of a time getting the service to bind on an onclick of a button, got that straightened out from help here yesterday. Now I actually want the service to bind in the onCreate() method of the activity. That part is no problem, works as intended.My service is actually a socket service to connect TCP sockets to a socket server that I wrote.If I put the call to the method from the bound service mBoundService.StartSocketServer() inside a button click, bingo, works great. But I need this to fire up immediately when the activity loads, so directly under my bindService() call within my onCreate() method of the activity.When I place the call to start the socket inside my onCreate() I get a force-close.

This method (StartSocketServer()) spawns a new thread then opens the socket on that thread to my remote machine.I'm guessing that the problem lies with the new thread generation before the activity fully loads not sure.LogCat is fairly cryptic here. It does say something about thread attach failed, then shows an uncaught handler exception that has "Caused by: java.lang.NullPointerException" within it.Again, if I put this call to the method inside a button click, I"m in business, if it's in the onCreate() it fails. Is there some way inside an activity (presuming that my assumption is correct that it needs to fully load before spawning a new thread) to call the StartSocketServer() after it's loaded: ala body.onLoad() in html?

View 1 Replies View Related

Android :: Calling A Non-static Java Method From C

Dec 22, 2009

In my Android app, I need to call a non static java method from C/C++. But i get a blunt crash when i do it using GetMethodID/CallVoidMethod()1 methods.

I have done like this:

1. Register the method using GetMethodID() as follows (mine is a cpp file): jmethodID xyz = (env)->GetMethodID( cls, "showxyz", "()V");

2. And I call this method as follows: env->CallVoidMethod(cls, xyz);

3. In java, my showxyz() is defined this way(this basically enables a button which was disabled) void showxyz() {findViewById(R.id.btnPass).setEnabled(true);}

And this crashes.

But I have been using this method of calling Java funcs from C using a set of GetStaticMethodID/CallStaticVoidMethod()(for nonstatic methods) and that works always.

But in this case, I have to call a non-static method and i get a crash.

View 2 Replies View Related

Android :: Error When Calling Method SetRequestedOrientation() / Fix It?

Aug 18, 2010

Code...

When the method is called setRequestedOrientation() - error. Create layout-land and placed there a copy of the main.xml file.

View 2 Replies View Related

Android :: Calling Superclass Method In Subclass Constructor

Apr 30, 2010

I get a NullPointerException calling a Superclass Method in Subclass Inner Class Constructor... What's the Deal?

In my application's main class (subclass of Application), I have a public inner class that simply contains 3 public string objects. In the parent class I declare an object of that inner class.

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

After I instantiate the object in the constructor, I get a runtime error when I try to assign a value in the inner class with a superclass method.

Can you not call superclass methods in the subclass constructor?

View 3 Replies View Related

Android :: Voice Recognition Activity Called In OnCreate Method / Causes App To Load Slowly

Oct 1, 2010

In my android app I call the voice recognition in my onCreate method of my startup activity. I have made it a preference to start up with the voice control or not. However, the app takes about 5-7 seconds to load when voice recognition is on. When it is off, the app starts almost instantly. Below is sample code, I have added Free_Form, max_results 1, and a custom prompt to mine.Why would calling the normal android speech recognition take sooo long to load in my OnCreate method?

View 1 Replies View Related

Android :: How To Stop Service Method Of Calling Activity Class?

Jul 2, 2010

I am trying to call my service class's stopService() method from my activity. But I don't know how to access stopservice method from my activity class. I have the below code but its not working. This is HomeScreen class:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
enablecheck = (CheckBox)findViewById(R.id.enablecheck);
enablecheck.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// TODO Auto-generated method stub
if(enablecheck.isChecked()){
startService(new Intent(HomeScreen.this, AutoService.class));
} else {
stopService(new Intent(HomeScreen.this, AutoService.class));
} } });
}
This is Service Class:
public class AutoService extends Service {
private static final String TAG = "AutoService";
private Timer timer;
private TimerTask task;
@Override
public IBinder onBind(Intent intent) {
return null;
} @Override
public void onCreate() {
Toast.makeText(this, "Auto Service Created", Toast.LENGTH_LONG).show();
Log.d(TAG, "onCreate");
int delay = 5000; // delay for 5 sec.
int period = 5000; // repeat every sec.
timer = new Timer();
timer.scheduleAtFixedRate(task = new TimerTask(){
public void run() {
System.out.println("done");
} }, delay, period);
}
@Override
public boolean stopService(Intent name) {
// TODO Auto-generated method stub
timer.cancel();
task.cancel();
return super.stopService(name);
} }

View 3 Replies View Related

Android :: How To Get Calling Activity Instance From Called Activity?

Jul 9, 2010

I have a Contact Activity which is derived from ListActivity, which displays list of contacts, and on click of item, a new Activity Message Activity derived from ListActivity is initialized.Now I know, I can pack some information in Bundle and pass it before creating activity, but is there a way I can get instance of "ContactActivity" in onCreate method of "MessageActivity"?

View 1 Replies View Related

Android :: Identify Current InputMethod Language?

Aug 19, 2009

How to identify the current InputMethod language?

View 2 Replies View Related

Android : Select A Specific InputMethod By Program/

Jul 13, 2009

I compiled the example SoftKeyboard in the SDK successfully, but to use it, user has to select it as default IME or select it by the context menu. How to select it by program and use it in an EditText?

View 8 Replies View Related

LG Eve :: Error - Inputmethod.xim - Phone Freezes And Reboots

May 1, 2010

I have a customers LG eve here, and I really, really don't want to wipe it or send it for repair, but the basic problem is that it turns on, you keep getting the error "The application LG IME (process com.android.inputmethod.xim) has stopped unexpectedly, Please try again. " This repeats a couple times then the phone freezes and reboots.

View 2 Replies View Related

Android :: Com.android.inputmethod.latin

Aug 20, 2009

I always see this process running, does any one know what this process does?

View 2 Replies View Related

Android :: Method OnBackPressed() Of Type FirstGroup Must Override Superclass Method

Sep 7, 2010

I'm trying to override the onBackPressed() method of the ActivityGroup class:

public class MyClass extends ActivityGroup {

@Override
public void onBackPressed() {
// do something
return;
}

but I'm getting the error The method onBackPressed() of type MyClass must override a superclass method. I'm relatively new to Java, I've seen here that people do it and it works for them Why I'm getting this error? I'm writing an app for android 1.5, could the problem be here?

View 1 Replies View Related

Android :: Show Method Definition - Eclipse Recognizes Warning On Method

Nov 22, 2010

In Eclipse, when I mouse hover over a built-in method, it displays a method definition including stuff like what the method does, input objects, return objects etc. If I have a yellow line (warning) under the method I'm trying to use, I can't get the mouse-over to show the definition. If I try hitting F3, I get a "The Jar of this class file belongs to container "Android 1.6" How do I show the definition of the method I am using when there is a warning?

View 1 Replies View Related







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