[android-developers] Return formatted time
Im trying to get the time a button is pressed and display it on the screen case R.id.btoMovies: statuschange.setText(To Movies); mystatus=2; Time now = new Time(); now.setToNow(); timeofchange.setText( + now); and it returns 20120401T232303GMT(0,91,0,0,122583) Im trying to get the time formatted MMDDTHHMMSS format ... is this the best way to do this ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Return formatted time
Im trying to get the time a button is pressed and display it on the screen case R.id.btoMovies: statuschange.setText(To Movies); mystatus=2; Time now = new Time(); now.setToNow(); timeofchange.setText( + now); and it returns 20120401T232303GMT(0,91,0,0,122583) Im trying to get the time formatted MMDDTHHMMSS format ... is this the best way to do this ? -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] accelerometer can I simply send meaning update location whenever the phone moves more than a meter
Preference this with this is my first android program and I have 3 problems... the code works below to a point ... what I am trying to do is to send location to a mysql data base every 30 seconds or if the sensor(accelerometer moves more than 3 meters). I'm trying to save battery life so it appears from my reading that the sensor class has a timer which I set to normal SENSOR_DELAY_NORMAL... what is happening is the API it is overwhelming my database sending information it seems like every second I only need it like 30 to 45 seconds tops and maybe not that often... also when I loaded it on my phone after a few seconds it would freeze and says that it stopped working... 1) why is it sending every second and how do I change that 2) if I just use the accelerometer can I simply send meaning update location whenever the phone moves more than a meter to save battery life or a timed send(Location update) or maybe every 15 minute if the phone hasn't updated because the sensor hasn't moved ... is this possible and how would I do that Also I'm pretty sure the problem the phone is having is with the constant sending of data but are there other issues I should be mindful of ... [syntax=java]package com.javacodegeeks.android.lbs; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.app.Activity; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.TextView; import android.widget.TextView.BufferType; import android.widget.Toast; public class LbsGeocodingActivity extends Activity implements OnClickListener, SensorEventListener { private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 3; // in // Meters private static final long MINIMUM_TIME_BETWEEN_UPDATES = 3; // in // Milliseconds protected LocationManager locationManager; protected Button retrieveLocationButton; protected Button resumebutton; protected Button pausebutton; protected Button quitbutton; public double longi; public double lati; TextView question, test, pwrd, longitudinal, lititudinal; static TextView connecting; SensorManager sm; String gotBread, teat, lockerroom, spotX, spotY; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); retrieveLocationButton = (Button) findViewById(R.id.retrieve_location_button); resumebutton =(Button)findViewById(R.id.bResume); pausebutton=(Button)findViewById(R.id.bPause); quitbutton=(Button)findViewById(R.id.bQuit); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MINIMUM_TIME_BETWEEN_UPDATES, MINIMUM_DISTANCE_CHANGE_FOR_UPDATES, new MyLocationListener()); sm = (SensorManager) getSystemService(Context.SENSOR_SERVICE); if (sm.getSensorList(Sensor.TYPE_ACCELEROMETER).size() != 0) { Sensor s = sm.getSensorList(Sensor.TYPE_ACCELEROMETER).get(0); sm.registerListener(this, s, SensorManager.SENSOR_DELAY_NORMAL); intialize(); Bundle gotBasket = getIntent().getExtras(); Bundle teatime = getIntent().getExtras(); gotBread = gotBasket.getString(key); teat = teatime.getString(lock); lockerroom = teatime.getString(combo); question.setText(gotBread); pwrd.setText(teat);
[android-developers] unknown error
This is my first android app and I feel like it should be simple but I had my code working then I added two button in my xml file and added a switch/case clause and now im getting an error... eclipse error log is not recording what the error is and no other error messages... the way my app works is it collects username, password and group and them it switches to my main xml where I am getting the error... any help would be appreciated ?xml version=1.0 encoding=utf-8? LinearLayout xmlns:android=http://schemas.android.com/apk/res/ android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent Button android:id=@+id/retrieve_location_button android:text=Retrieve Location android:layout_width=wrap_content android:layout_height=wrap_content / TextView android:id=@+id/tvMessage android:layout_width=wrap_content android:layout_height=wrap_content android:text=TextView / TextView android:id=@+id/tvPassworded android:layout_width=wrap_content android:layout_height=wrap_content android:text=TextView / TextView android:id=@+id/tVLast android:layout_width=wrap_content android:layout_height=wrap_content android:text=TextView / TextView android:text=TextView android:id=@+id/tvLat android:layout_width=wrap_content android:layout_height=wrap_content/TextView TextView android:text=TextView android:id=@+id/tvLong android:layout_width=wrap_content android:layout_height=wrap_content/TextView TextView android:text=TextView android:id=@+id/tvconnecting android:layout_width=wrap_content android:layout_height=wrap_content/TextView Button android:text=Pause android:id=@+id/bPause android:layout_width=fill_parent android:layout_height=wrap_content/Button Button android:text=Resume android:id=@+id/bResume android:layout_width=fill_parent android:layout_height=wrap_content/Button Button android:text=Quit android:id=@+id/bQuit android:layout_width=fill_parent android:layout_height=wrap_content/Button /LinearLayout and I added a switch and case to my LbsGeocodingActivity class import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.RadioGroup; import android.widget.RadioGroup.OnCheckedChangeListener; import android.widget.TextView; import android.widget.TextView.BufferType; import android.widget.Toast; public class LbsGeocodingActivity extends Activity implements OnClickListener, OnCheckedChangeListener { private static final long MINIMUM_DISTANCE_CHANGE_FOR_UPDATES = 1; // in // Meters private static final long MINIMUM_TIME_BETWEEN_UPDATES = 1000; // in // Milliseconds protected LocationManager locationManager; protected Button retrieveLocationButton; protected Button resumebutton; protected Button pausebutton; protected Button quitbutton; public double longi; public double lati; TextView question, test, pwrd, longitudinal, lititudinal; static TextView connecting; String gotBread, teat, lockerroom, spotX, spotY; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); retrieveLocationButton = (Button) findViewById(R.id.retrieve_location_button); resumebutton =(Button)findViewById(R.id.bResume); pausebutton=(Button)findViewById(R.id.bPause); quitbutton=(Button)findViewById(R.id.bQuit); locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, MINIMUM_TIME_BETWEEN_UPDATES,
[android-developers] Re: unknown error
Eclipse is not throwing an error ... when I goto run my app in the emulator it says it has encountered and error On Feb 12, 4:12 pm, TreKing treking...@gmail.com wrote: On Sun, Feb 12, 2012 at 2:18 PM, aikidoguy clayrichmo...@gmail.com wrote: now im getting an error... the way my app works is it collects username, password and group and them it switches to my main xml where I am getting the error... You posted a lot but you failed to mention the actual error you're seeing. That would be useful information for someone trying to help you. - TreKing http://sites.google.com/site/rezmobileapps/treking - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: unknown error
Event Details says: Invalid preference page path: XML Syntax Exception stack trace An exception stack trace is not available. On Feb 12, 4:22 pm, Mark Murphy mmur...@commonsware.com wrote: On Sun, Feb 12, 2012 at 4:20 PM, aikidoguy clayrichmo...@gmail.com wrote: Eclipse is not throwing an error ... when I goto run my app in the emulator it says it has encountered and error Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your error. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 4.0 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: unknown error
02-12 16:37:04.666: ERROR/AndroidRuntime(272): java.lang.RuntimeException: Unable to resume activity {com.javacodegeeks.android.lbs/ com.javacodegeeks.android.lbs.LbsGeocodingActivity}: android.app.SuperNotCalledException: Activity {com.javacodegeeks.android.lbs/ com.javacodegeeks.android.lbs.LbsGeocodingActivity} did not call through to super.onResume() On Feb 12, 4:22 pm, Mark Murphy mmur...@commonsware.com wrote: On Sun, Feb 12, 2012 at 4:20 PM, aikidoguy clayrichmo...@gmail.com wrote: Eclipse is not throwing an error ... when I goto run my app in the emulator it says it has encountered and error Use adb logcat, DDMS, or the DDMS perspective in Eclipse to examine LogCat and look at the stack trace associated with your error. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy Android 4.0 Programming Books:http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] my first android program ever I usually code in python
I apologize I understand this is a more advance list but I don't know where else to turn This is my first android program ever I usually code in python... I've watch a ton of java tutorials but Java is so different I'm having trouble ...so here is what I need to do... I have my Main class and it collects user input and returns the variable public string username and public string password then I have a gps Class and it return the variable public double longitudes and public double latitude... in python I would make these global variable(ie self.username ... etc ) collect the data into in a method and send it to the server in mysql format... I have a new class and Its called GetdataandSend public calss GetdataandSend(){ I want to collect the variables from my Main Class and gps class store the variables and then send to the server the data (using Mysql fomat) } Do I have to use a bunch of classes or is it possible to use top down coding while Im new since this app is relatively simple I getting the user name, password and longitude and latitude and every 15 seconds or onResume send that to my (Mysql db)php server ...can some one point me in a direction of some tutorials or examples of this ... thanks -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en