I have an app that uses the LocationManage functions which works well until the app is stopped or paused. The location listener function is still carrying on in the background. Relevant bits of code follow. When I click home or back the onstop() function is being triggered correctly.
package uk.cr.anchor;
import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.media.MediaPlayer;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TableRow;
import android.widget.Toast;
import android.widget.ToggleButton;
import android.content.SharedPreferences;
import android.graphics.Color;
public class main extends Activity {
/** Called when the activity is first created. */
private LocationManager mlocManager;
private LocationListener mlocListener;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LocationManager mlocManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
LocationListener mlocListener = new MyLocationListener();
mlocManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, mlocListener);
}
@Override
protected void onStop(){
stoplistening();
super.onStop();
}
/* Class My Location Listener */
public class MyLocationListener implements LocationListener
{
@Override
public void onLocationChanged(Location loc)
{
loc.getLatitude();
loc.getLongitude();
etc etc etc
}
private void stoplistening() {
if (mlocManager != null) {
Toast.makeText( getApplicationContext(),
"kill",
Toast.LENGTH_SHORT ).show();
mlocManager.removeUpdates(mlocListener);
}
else {
Toast.makeText( getApplicationContext(),
" not kill",
Toast.LENGTH_SHORT ).show();
}
}
}
I always get the "not kill" message.
Can anyone help me!
Hi,
Is it possible to hilight part of a text and copy in Android?
It's kinda like how in iPhone, when you hold a text for sometime, the box will show up and you can copy then paste that somewhere?
Thanks,
Tee
Do you know any books, articles, examples, screencasts that document how to develop an home screen widget on Android?
I just found these links:
widget design guidelines
Introducing home screen widgets and the AppWidget framework
I would like to develop a tiny home screen ticker and i'm searching for the proper way to code it.
How to get the dirty(changed) properties(any controls subclasses of view) amongst a number of properties on a layout. Does android has a dirty flag to mark if the layout has any field that has a changed content??
Android - What is the maximum file size that setMaxFileSize can be set to in respect to Androids mediarecorder? I know it's somewhere between 4147483650 and 5147483650. Why is there a limit in the first place?
I'm recording on to a SDCARD, detecting the size of the cards space before we run.
"ERROR/AuthorDriver(31): setParameter(max-filesize = 7270309850) failed with result -5"
"ERROR/AuthorDriver(31): Ln 903 handleSetParameters("max-filesize=7270309850") error"
"ERROR/AndroidRuntime(409): java.lang.RuntimeException: setMaxFileSize failed."
hi....I'm new to android.I'm developing an app in which I'm trying to find north direction of my device anyone who can solve my problem it would be great full.thanks in advance..
Hi,
can any one please send me the project(in android) where there is only client program which can connect to server and read the response from the server.send to my mail id [email protected]
Thanks and Regards,
Pushpa
android uses sqlite database to store data, I need to encrypt the sqlite database, how can this be done? I understand that application data is private. However I need to explictly encrypt the sqlite database that my app is using.
Hi,
I would like to create a program wich communicates between pc and an android mobile connected to USB via tcp/ip. Is this possible? How can I get the IP-address to a connected mobile from PC or the other way around?
Any help appreciated
parse .ics Calendar file using Ical4J in android.i saw the http://ical4j.sourceforge.net/introduction.html.how to use that ical4j-1.0-rc3.jar file in my project.I need help related to this plz ?
I am new to android
i want to develope Calendar application that shows events of current day.
it should fling to next or previous day
Thanks and Regards
Sasil
I am planning to develop an accelerometer based mouse on the android platform. the mobile device which i plan to use is htc nexus one. the cursor should move as the mobile is moved is space. will that be difficult compard to movement wrt gravity?
I need 2 ways of showing vertical label in Android:
Horizontal label turned 90 degrees counterclockwise (letters on the side)
Horizontal label with letters one under the other (like a store sign)
Do I need to develop custom widgets for both cases (one case), can I make TextView to render that way, and what would be a good way to do something like that if I need to go completely custom?
good day
we are developing game for android and have some trouble with resource loading on high dpi devices.
our resources are located in res/drawable directory
on a standart dpi device the game work properly, but on hdpi (tested on HTC Desire) all resources which located in res/drawable-hdpi load are loaded correctly, but the resources which miss in drawable-hdpi directory but present in res/drawable are ignored
but everything works fine on the virtual device with hdpi.
does anybody encounter this problem and know how to solve it?
Team,
Can you please help me to understand why I m getting the following exception.
05-07 10:57:20.652: ERROR/AndroidRuntime(470): android.database.sqlite.SQLiteException: near "1": syntax error: , while compiling: SELECT Id,Name FROM act WHERE Id 1-IJUS-1
Thanks in advance,
Hello,
I was trying to add more than one images in the AnimateDrawables under com.example.android.apis.graphics, but for some reason I couldn't. Can anyone post a sample code on how to accomplish it or at least explain it to me? This beginner programmer would really appreciate it.
Thanks
Hello, i need some help in how to start developing two android applications (on one phone) which communicate with each other.
1. Application A sends a string to application B
2. Application B receives the string for example "startClassOne", app B using a method starts classOne and gets the result. The result is send back (again as string!) to Application A.
3. Application A writes in console the received string from B.
Hi, When i give the scrollbar height as 320sp in andoir ,it is okay for my application in android but in droid the same code for that scroll bar but it is too small in that how can i adjust ? Give me some suggestions.Thanks in advance?