[android-developers] Trying to change the screen brightness programmatically
Well after taking a few days off its time to hit the bricks again. So here I am asking for help as to why my program is not setting the brightness requested... Here is the code I have so far. import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.view.WindowManager; public class bright extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); int brightnessMode = 0; try { brightnessMode = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE); } catch (SettingNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) { Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); } WindowManager.LayoutParams layoutParams = getWindow().getAttributes(); layoutParams.screenBrightness = 0.5F; // set 50% brightness getWindow().setAttributes(layoutParams); Intent i = new Intent(this, StartSpark.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } } I heard some place that when you do things like this you need to send out a new window in order for it to refresh and take on the new brightness properties. So that is why I have the intent set up at the bottom. I have been messing with this on my own for a while now but everything I am trying is coming up dead... And not in the way I want it to be.. So what am I doing wrong? -- 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] running into an NPE error on a setText();
I'm working on a piece of code that is a settings activity for an app widget. Right now I have the code set up that if takes the saved value of the number and enters it into the text view of another activity via shared settings. The issue I am running into is that when press the load button it fires an NPE at me on the given line of code which is: Line 48 AKA: dataResults.setText(dataReturned); I will post the whole code for this setting as well as its related logcat below: import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class WWSettings extends Activity implements OnClickListener { EditText sharedData; Context c; TextView dataResults; public static String filename = sharedString; SharedPreferences someData; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.widgetconfig); Button b = (Button) findViewById(R.id.btnwidgetconfig); Button b1 = (Button) findViewById(R.id.loadBtnWidgetConfig); c = WWSettings.this; b.setOnClickListener(this); b1.setOnClickListener(this); sharedData = (EditText)findViewById(R.id.etwidgitconfig); dataResults = (TextView)findViewById(R.id.userNum); someData = getSharedPreferences(filename, 0); } public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.btnwidgetconfig: String stringData = sharedData.getText().toString(); SharedPreferences.Editor editor = someData.edit(); editor.putString(sharedString, stringData); editor.commit(); break; case R.id.loadBtnWidgetConfig: someData = getSharedPreferences(filename, 0); String dataReturned = someData.getString(sharedString, Can't LoadSorry!); dataResults.setText(dataReturned); break; } } } And the logcat: 07-29 08:42:00.360: E/AndroidRuntime(9249): FATAL EXCEPTION: main 07-29 08:42:00.360: E/AndroidRuntime(9249): java.lang.NullPointerException 07-29 08:42:00.360: E/AndroidRuntime(9249): at lionsimage.com.onClick(Settings.java:48) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.view.View.performClick(View.java:2485) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.view.View$PerformClick.run(View.java:9080) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.os.Handler.handleCallback(Handler.java:587) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.os.Handler.dispatchMessage(Handler.java:92) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.os.Looper.loop(Looper.java:130) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.app.ActivityThread.main(ActivityThread.java:3683) 07-29 08:42:00.360: E/AndroidRuntime(9249): at java.lang.reflect.Method.invokeNative(Native Method) 07-29 08:42:00.360: E/AndroidRuntime(9249): at java.lang.reflect.Method.invoke(Method.java:507) 07-29 08:42:00.360: E/AndroidRuntime(9249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) 07-29 08:42:00.360: E/AndroidRuntime(9249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622) 07-29 08:42:00.360: E/AndroidRuntime(9249): at dalvik.system.NativeStart.main(Native Method) -- 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
Re: [android-developers] running into an NPE error on a setText();
The error is fixed, but now when I go to use the settings its not showing what I have set. Should I open a thread for this? On Sunday, July 29, 2012 8:59:23 AM UTC-4, Mark Murphy (a Commons Guy) wrote: First, clean your project (Project Clean from Eclipse main menu, or ant clean from the command line). Then rebuild and try again. Sometimes, the R values get a bit out of sync with other precompiled Java code, and cleaning the project clears that up. If the error persists, then apparently res/layout/widgetconfig.xml does not have a widget named @+id/userNum, which is why dataResults would be null. On Sun, Jul 29, 2012 at 8:50 AM, Cythes cytheshic...@gmail.com wrote: I'm working on a piece of code that is a settings activity for an app widget. Right now I have the code set up that if takes the saved value of the number and enters it into the text view of another activity via shared settings. The issue I am running into is that when press the load button it fires an NPE at me on the given line of code which is: Line 48 AKA: dataResults.setText(dataReturned); I will post the whole code for this setting as well as its related logcat below: import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class WWSettings extends Activity implements OnClickListener { EditText sharedData; Context c; TextView dataResults; public static String filename = sharedString; SharedPreferences someData; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.widgetconfig); Button b = (Button) findViewById(R.id.btnwidgetconfig); Button b1 = (Button) findViewById(R.id.loadBtnWidgetConfig); c = WWSettings.this; b.setOnClickListener(this); b1.setOnClickListener(this); sharedData = (EditText)findViewById(R.id.etwidgitconfig); dataResults = (TextView)findViewById(R.id.userNum); someData = getSharedPreferences(filename, 0); } public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.btnwidgetconfig: String stringData = sharedData.getText().toString(); SharedPreferences.Editor editor = someData.edit(); editor.putString(sharedString, stringData); editor.commit(); break; case R.id.loadBtnWidgetConfig: someData = getSharedPreferences(filename, 0); String dataReturned = someData.getString(sharedString, Can't LoadSorry!); dataResults.setText(dataReturned); break; } } } And the logcat: 07-29 08:42:00.360: E/AndroidRuntime(9249): FATAL EXCEPTION: main 07-29 08:42:00.360: E/AndroidRuntime(9249): java.lang.NullPointerException 07-29 08:42:00.360: E/AndroidRuntime(9249): at lionsimage.com.onClick(Settings.java:48) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.view.View.performClick(View.java:2485) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.view.View$PerformClick.run(View.java:9080) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.os.Handler.handleCallback(Handler.java:587) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.os.Handler.dispatchMessage(Handler.java:92) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.os.Looper.loop(Looper.java:130) 07-29 08:42:00.360: E/AndroidRuntime(9249): at android.app.ActivityThread.main(ActivityThread.java:3683) 07-29 08:42:00.360: E/AndroidRuntime(9249): at java.lang.reflect.Method.invokeNative(Native Method) 07-29 08:42:00.360: E/AndroidRuntime(9249): at java.lang.reflect.Method.invoke(Method.java:507) 07-29 08:42:00.360: E/AndroidRuntime(9249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864) 07-29 08:42:00.360: E/AndroidRuntime(9249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622) 07-29 08:42:00.360: E/AndroidRuntime(9249): at dalvik.system.NativeStart.main(Native Method) -- 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 -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.8 Available! -- You received this message because you are subscribed to the Google
[android-developers] Shared Pref data passing is not working.
right now I'm still working on the same code I posted from before I just fixed the mentioned NPE, now the data I enter and load is not loading up properly in another class. It saves with in the setting activity but as soon as I call it into something else. It calls improper data into the area I am trying to set it to. On top of all of this I'm building this as I widget so after the Settings window is up I have to press home to get out of it. How do I set this so it loads up the widget after I set the details (I think this might be where the issue is coming from.). Its kinda like burner on a stove. One ring goes out the whole burner is shot. Either way here is the code(again) import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Settings extends Activity implements OnClickListener { EditText sharedData; Context c; TextView dataResults; public static String filename = sharedString; SharedPreferences someData; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.widgetconfig); Button b = (Button) findViewById(R.id.btnwidgetconfig); Button b1 = (Button) findViewById(R.id.loadBtnWidgetConfig); c = Settings.this; b.setOnClickListener(this); b1.setOnClickListener(this); sharedData = (EditText)findViewById(R.id.etwidgitconfig); dataResults = (TextView)findViewById(R.id.emsSetWidgetConfig); someData = getSharedPreferences(filename, 0); } public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.btnwidgetconfig: String stringData = sharedData.getText().toString(); SharedPreferences.Editor editor = someData.edit(); editor.putString(sharedString, stringData); editor.commit(); break; case R.id.loadBtnWidgetConfig: someData = getSharedPreferences(filename, 0); String dataReturned = someData.getString(sharedString, Can't LoadSorry!); dataResults.setText(dataReturned); break; } } } And there is no error to speak of in this case... I'm just wondering how I glue this all together... -- 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] Programatically changing the screen brightness
I'm now for sure 99% of the way complete on my code... I need to know one last thing. How do I programatically dim the of the android. I have tried making a set of intent groups. One loads the code for the dimmer then intents into the actual program and that runs with little issue other then the screen did not dim after the screen flipped over. Here is the code I am using: import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.provider.Settings; import android.view.WindowManager; public class bright extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); Settings.System.putInt(this.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, 20); WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.screenBrightness =0.0f;// 100 / 100.0f; getWindow().setAttributes(lp); Intent i = new Intent(this, gateBridge.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); finish(); } } Since I know brightness settings can only be used after the screen has been reset or changed. So the question, how do I get this done? -- 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] Launching an intent from a Widget Settings Class
The title pretty much sums up what I am trying to do at this point. I have 99.9% of my code done but now its just a matter of debugging the question present is: Is there a way to set an intent with in a settings class if not how would I go about making the settings class its own app icon so users can get to set up any time. The catch is the app I am working on is a system that is set up to instant fire so there is no time to get into a settings window from with in the app itself. -- 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] No internet Calling account Error
I'm writing a piece of code that has a error every time I run it stating: -No internet calling account availible I'm wondering if there is some kind of permissions involved in this or something else I am missing. -- 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
Re: [android-developers] Is there any logical way to make a notification bigger / Make more then one.
Thanks for the reply, sorry it took so long but we ended up going a different route. On Sunday, July 22, 2012 4:50:03 PM UTC-4, Dianne Hackborn wrote: JB added support for larger notifications. You can not force them to display larger, however, they will change in size for various reasons as appropriate. It sounds to me like what you are trying to do may not be what notifications are intended for. On Sun, Jul 22, 2012 at 1:41 PM, Cythes cytheshic...@gmail.com wrote: I'm trying to work on an app that runs out of a notification. Right now I am trying to make the notification bigger so it has more prevalence on the screen. And if that is not possible how do I make more then one notification so it runs one next to the other effectively making the app notification bigger.. -- 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 -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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] Trying to black out screen programatically
So this is really a repost from Stack Overflow so that is out there in the open. Here is what I am trying to do, I'm trying to get the screen to black out when I run the app in question. I know this sounds Spam-like but I assure you this app is being built in the best of intentions. So here is the basic jist of the code I need a hand with: WindowManager.LayoutParams lp = getWindow().getAttributes(); float brightness = 1.0f; lp.screenBrightness = brightness; getWindow().setAttributes(lp); I have also tried: android.provider.Settings.System.putInt(this.getContentResolver(), android.provider.Settings.System.SCREEN_BRIGHTNESS, ); As well as: WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.BRIGHTNESS_OVERRIDE_OFF; So Whats going on here? -- 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] Is there any logical way to make a notification bigger / Make more then one.
I'm trying to work on an app that runs out of a notification. Right now I am trying to make the notification bigger so it has more prevalence on the screen. And if that is not possible how do I make more then one notification so it runs one next to the other effectively making the app notification bigger.. -- 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
Re: [android-developers] Keeping it fresh, back to service...
So in the end what I am trying to do is illogical and cant be done some out of the blue way with out building a custom ROM It has to be an app... Which is a shame since I am so close to figuring it out. The service runs fine... Maybe just maybe having it call the camera button press if the volume is pushed down for longer then X amount of time. What can I say I'm stubborn. On Saturday, July 14, 2012 5:14:12 PM UTC-4, Mark Murphy (a Commons Guy) wrote: On Sat, Jul 14, 2012 at 5:03 PM, Cythes cytheshic...@gmail.com wrote: So if I take it back to the regular dispatchkeyevent, it should fix it or do I need to find something to call it to? IN which case would be my main activity. Simply have your activity handle the key event itself, and delete your service and your boot receiver. Having a service running all of the time is something users generally dislike, and the service is not helping you, since the activity is perfectly capable of handling your current business logic with respect to the key event. If you are somehow thinking that you will have something in the background that can respond to key events like this, that does not work. A couple of key events will get broadcast if the foreground activity does not consume the event (e.g., ACTION_CAMERA_BUTTON). Otherwise, key events are for the use of the foreground activity and the OS. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.8 Available! -- 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
Re: [android-developers] Keeping it fresh, back to service...
I never really figured it out how to get it to work on my phone. Something I will be looking into after I try this idea out. On Monday, July 16, 2012 11:40:26 AM UTC-4, MagouyaWare wrote: Keep in mind I am on my live phone so I DONT have logcat. This makes no sense... I use my live phone for development and it isn't rooted... I have logcat. Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Mon, Jul 16, 2012 at 8:43 AM, Cythes cytheshic...@gmail.com wrote: So in the end what I am trying to do is illogical and cant be done some out of the blue way with out building a custom ROM It has to be an app... Which is a shame since I am so close to figuring it out. The service runs fine... Maybe just maybe having it call the camera button press if the volume is pushed down for longer then X amount of time. What can I say I'm stubborn. On Saturday, July 14, 2012 5:14:12 PM UTC-4, Mark Murphy (a Commons Guy) wrote: On Sat, Jul 14, 2012 at 5:03 PM, Cythes cytheshic...@gmail.com wrote: So if I take it back to the regular dispatchkeyevent, it should fix it or do I need to find something to call it to? IN which case would be my main activity. Simply have your activity handle the key event itself, and delete your service and your boot receiver. Having a service running all of the time is something users generally dislike, and the service is not helping you, since the activity is perfectly capable of handling your current business logic with respect to the key event. If you are somehow thinking that you will have something in the background that can respond to key events like this, that does not work. A couple of key events will get broadcast if the foreground activity does not consume the event (e.g., ACTION_CAMERA_BUTTON). Otherwise, key events are for the use of the foreground activity and the OS. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.8 Available! -- 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 -- 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] Maybe I am going about this all wrong.
Let me put an idea out there that I am thinking about in my head, What are the odds of an app running all the time in the foreground only minimized rather then as a service. Kinda like a clock or antivirus. I know for a fact that these things can be done since you need to look no further then (almost) any screen on your android to see the clock ticking away. Still there is a physical app behind it. Something you can go to and view in a bigger scale. That is all I am trying to accomplish. -- 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
Re: [android-developers] Maybe I am going about this all wrong.
What about just writing a patch for the OS and including it in the package? Or is that next to unheard of? On Saturday, July 14, 2012 12:50:17 PM UTC-4, Mark Murphy (a Commons Guy) wrote: On Sat, Jul 14, 2012 at 12:45 PM, Cythes cytheshic...@gmail.com wrote: What are the odds of an app running all the time in the foreground only minimized rather then as a service. That will not work reliably. Kinda like a clock or antivirus. I know for a fact that these things can be done since you need to look no further then (almost) any screen on your android to see the clock ticking away. That is part of the firmware. You are certainly welcome to create your own modded Android ROM. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.8 Available! -- 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
Re: [android-developers] Maybe I am going about this all wrong.
Which part? On Saturday, July 14, 2012 2:19:52 PM UTC-4, Kristopher Micinski wrote: That would be interesting... On Jul 14, 2012 1:10 PM, Mark Murphy mmur...@commonsware.com wrote: On Sat, Jul 14, 2012 at 1:04 PM, Cythes cytheshic...@gmail.com wrote: What about just writing a patch for the OS and including it in the package? Or is that next to unheard of? If by the package you mean your APK, that is not supported. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.8 Available! -- 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 -- 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] Keeping it fresh, back to service...
Alright here I am after a good 8 hours of editing (Yeah I'm new..so sue me...) I'm working on this service that starts on start up. Keep in mind I am on my live phone so I DONT have logcat. On top of this it is a Rooted phone so if that changes anything then I guess I will burn that bridge after I cross it. Till then I could use a hand. Here is the service code..once again: import android.app.Service; import android.content.Intent; import android.net.Uri; import android.os.IBinder; import android.os.Vibrator; import android.util.Log; import android.view.KeyEvent; import android.widget.Toast; public class Monitor extends Service { private static final String LOG_TAG = ::Monitor; @Override public void onCreate() { super.onCreate(); Log.e(LOG_TAG, Service created.); } public void onStartCommand() { Log.e(LOG_TAG, Service started.); Toast.makeText(this, Test launch started, 600).show(); } boolean dispatchKeyEventTake2(KeyEvent event) { int action = event.getAction(); int keyCode = event.getKeyCode(); int ticker = event.getRepeatCount(); final Vibrator vibrator = (Vibrator) getSystemService(VIBRATOR_SERVICE); switch (keyCode) { case KeyEvent.KEYCODE_VOLUME_DOWN: if (action == KeyEvent.ACTION_DOWN ticker == 50) { Intent MainIntent = new Intent(help.me.please.MainActivity); MainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(MainIntent); } return true; default: return this.dispatchKeyEventTake2(event); } } @Override public IBinder onBind(Intent intent) { Log.e(LOG_TAG, Service bind.); return null; } } As well as the manifest: manifest xmlns:android=http://schemas.android.com/apk/res/android; installlocation=internalOnly package=help.me.please android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=9 android:targetSdkVersion=15 / uses-permission android:name=android.permission.RECEIVE_BOOT_COMPLETED / uses-permission android:name=android.permission.VIBRATE / uses-permission android:name=android.permission.CALL_PHONE / application android:icon=@drawable/ic_launcher android:label=@string/app_name android:theme=@style/AppTheme service android:name=.Monitor intent-filter action android:name=help.me.please.Monitor /action /intent-filter /service activity android:name=.MainActivity android:label=@string/title_activity_main intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.DEFAULT / /intent-filter /activity receiver android:name=autoBot intent-filter action android:name=android.intent.action.BOOT_COMPLETED /action /intent-filter /receiver /application /manifest Basically the program runs starts the service but wont start the intent in the service. Any ideas? -- 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
Re: [android-developers] Keeping it fresh, back to service...
So if I take it back to the regular dispatchkeyevent, it should fix it or do I need to find something to call it to? IN which case would be my main activity. On Saturday, July 14, 2012 4:55:54 PM UTC-4, Mark Murphy (a Commons Guy) wrote: On Sat, Jul 14, 2012 at 4:50 PM, Cythes cytheshic...@gmail.com wrote: Basically the program runs starts the service but wont start the intent in the service. Any ideas? Nothing calls dispatchKeyEventTake2() in your service. And it is a good thing nobody does call dispatchKeyEventTake2() in your service, as you have an infinite recursion for anything other than VOLUME_DOWN, since you call your own dispatchKeyEventTake2() again in the default case. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy _The Busy Coder's Guide to Android Development_ Version 3.8 Available! -- 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] Service launch issues
Alright I got a good bit of help in my last question so instead of beat my head against the wall I have decided it would be better to post my code for my auto starter / service / manifest here and see what I can get. It goes like this: Auto starter(Just fixed) -- Service -- Main activity So I am not so much worried about the first and last steps as they are both taken care of. I just need to figure out how to get the auto starter to run the service which ties the main activity to the background. So the question: Why is it that when I run this it starts the app then promptly crashes it about 30 seconds later also why is the app not going to the background instead of staying up front? here is the code: package path.to.file; import android.app.Service; import android.content.Intent; import android.os.IBinder; import android.util.Log; public class Monitor extends Service { private static final String LOG_TAG = ::Monitor; @Override public void onCreate() { super.onCreate(); Log.e(LOG_TAG, Service created.); Intent i = new Intent(); i.setAction(path.to.file.MainActivity); i.addCategory(Intent.CATEGORY_HOME); startActivity(i); } @Override public void onStart(Intent intent, int startId) { super.onStartCommand(intent, startId, startId); Log.e(LOG_TAG, Service started.); } @Override public void onDestroy() { super.onDestroy(); Log.e(LOG_TAG, Service destroyed.); } @Override public IBinder onBind(Intent intent) { Log.e(LOG_TAG, Service bind.); return null; } } As well as the updated manifest: manifest xmlns:android=http://schemas.android.com/apk/res/android; installlocation=internalOnly package=path.to.file android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=9 android:targetSdkVersion=15 / uses-permission android:name=android.permission.RECEIVE_BOOT_COMPLETED / uses-permission android:name=android.permission.VIBRATE / uses-permission android:name=android.permission.CALL_PHONE / application android:icon=@drawable/ic_launcher android:label=@string/app_name android:theme=@style/AppTheme activity android:name=.MainActivity android:label=@string/title_activity_main intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity service android:name=Monitor intent-filter action android:name=path.to.file.Monitor /action /intent-filter /service receiver android:name=autoBot intent-filter action android:name=android.intent.action.BOOT_COMPLETED /action /intent-filter /receiver /application /manifest -- 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: Service launch issues
Alright first thing is first, I dont have logcat since I am running it all out of my phone. I know there is a way to get logcat to run with phone tethering. Also sorry for the cross post it seemed at the time the topic was dead so I wanted to post it over here to get a second look. On Friday, July 13, 2012 4:58:28 PM UTC-4, Nobu Games wrote: http://stackoverflow.com/questions/11476906/service-launches-then-crashes If you feel like cross-posting your own questions then please take the advice of the guys over at Stackoverflow seriously and post the exception message / log cat / stack trace, too. It crashes after 30 seconds can have a billion different reasons. -- 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
Re: [android-developers] Re: Service launch issues
I seem to be getting This isn't possible quite a bit. I know I'm not a genius at this stuff in fact I'm far from it but every time someone says that I have been finding usable workaround's. Please note this is not me being cocky. Just something I am noticing. On Friday, July 13, 2012 5:04:25 PM UTC-4, MagouyaWare wrote: Wait, I just realized something... you are wanting your activity to run in the background? AFAIK this isn't possible... why are you wanting to do this? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Jul 13, 2012 at 2:58 PM, Nobu Games dev.nobu.ga...@gmail.comwrote: http://stackoverflow.com/questions/11476906/service-launches-then-crashes If you feel like cross-posting your own questions then please take the advice of the guys over at Stackoverflow seriously and post the exception message / log cat / stack trace, too. It crashes after 30 seconds can have a billion different reasons. -- 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 -- 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
Re: [android-developers] Re: Service launch issues
The service, since that is the natural flow of things. Sorry for taking so long to get back. Dinner / coffee run, Back now till about 8:00est. On Friday, July 13, 2012 5:39:22 PM UTC-4, Tommy wrote: Activities have to run in the foreground. Services run in the background. Maybe we are just misunderstanding. What exactly do you want to run in the background? *From:* android-developers@googlegroups.com [mailto: android-developers@googlegroups.com] *On Behalf Of *Cythes *Sent:* Friday, July 13, 2012 5:20 PM *To:* android-developers@googlegroups.com *Subject:* Re: [android-developers] Re: Service launch issues I seem to be getting This isn't possible quite a bit. I know I'm not a genius at this stuff in fact I'm far from it but every time someone says that I have been finding usable workaround's. Please note this is not me being cocky. Just something I am noticing. On Friday, July 13, 2012 5:04:25 PM UTC-4, MagouyaWare wrote: Wait, I just realized something... you are wanting your activity to run in the background? AFAIK this isn't possible... why are you wanting to do this? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Jul 13, 2012 at 2:58 PM, Nobu Games dev.nobu.ga...@gmail.com wrote: http://stackoverflow.com/questions/11476906/service-launches-then-crashes If you feel like cross-posting your own questions then please take the advice of the guys over at Stackoverflow seriously and post the exception message / log cat / stack trace, too. It crashes after 30 seconds can have a billion different reasons. -- 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 -- 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 -- 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
Re: [android-developers] Re: Service launch issues
Actually to be specific I am looking to make my main activity run from the service via intent. however if need be I can just take my code from the main activity, I can just put the code into the service. On Friday, July 13, 2012 5:39:22 PM UTC-4, Tommy wrote: Activities have to run in the foreground. Services run in the background. Maybe we are just misunderstanding. What exactly do you want to run in the background? *From:* android-developers@googlegroups.com [mailto: android-developers@googlegroups.com] *On Behalf Of *Cythes *Sent:* Friday, July 13, 2012 5:20 PM *To:* android-developers@googlegroups.com *Subject:* Re: [android-developers] Re: Service launch issues I seem to be getting This isn't possible quite a bit. I know I'm not a genius at this stuff in fact I'm far from it but every time someone says that I have been finding usable workaround's. Please note this is not me being cocky. Just something I am noticing. On Friday, July 13, 2012 5:04:25 PM UTC-4, MagouyaWare wrote: Wait, I just realized something... you are wanting your activity to run in the background? AFAIK this isn't possible... why are you wanting to do this? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Jul 13, 2012 at 2:58 PM, Nobu Games dev.nobu.ga...@gmail.com wrote: http://stackoverflow.com/questions/11476906/service-launches-then-crashes If you feel like cross-posting your own questions then please take the advice of the guys over at Stackoverflow seriously and post the exception message / log cat / stack trace, too. It crashes after 30 seconds can have a billion different reasons. -- 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 -- 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 -- 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] App claims to have stopped then instantly starts afterward?
Right now I am in the process of working out this little bug as I want to call it. I'm almost certain that it is a manifest issues so I will post the code to the manifest down below. Going on what the title says. When I load my app into the emulator it installs just fine, but as soon as it goes to start it stops but then starts right afterward? At this point in time I am working on trying to make the app in question run in the background. Here is the manifest file since I have deduced that it is an issue in here: manifest xmlns:android=http://schemas.android.com/apk/res/android; package=path.to.this android:versionCode=1 android:versionName=1.0 uses-sdk android:minSdkVersion=9 android:targetSdkVersion=15 / uses-permission android:name=android.permission.RECEIVE_BOOT_COMPLETED / uses-permission android:name=android.permission.VIBRATE / uses-permission android:name=android.permission.CALL_PHONE / application android:icon=@drawable/ic_launcher android:label=@string/app_name android:theme=@style/AppTheme receiver android:name=path.to.this.AUTOBOT android:enabled=true android:permission=android.permission.RECEIVE_BOOT_COMPLETED intent-filter action android:name=android.intent.action.BOOT_COMPLETED / category android:name=android.intent.category.DEFAULT / /intent-filter /receiver activity android:name=.MainActivity android:label=@string/title_activity_main intent-filter action android:name=android.intent.action.MAIN / category android:name=android.intent.category.LAUNCHER / /intent-filter /activity service android:name=path.to.this.myService /service /application /manifest Maybe I'm calling something wrong? -- 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] Eclipse Juno: Does not want to play well with android SDK.
So I keep trying to install the new SDK but every time I do it says most of the stuff is already installed. However, I cant find android anywhere in eclipse 4.2 Any help regarding this matter would be greatly appreciated. -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
[android-developers] Some Silly error, tailed with a huge headache.
For some reason eclipse thinks the ()'s are wrong. Here is the code for that part... notifyDetails.setLatestEvent(Infocontext, contentTitle, contentText, intent); mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails); Any idea what can be causing 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] Re: Some Silly error, tailed with a huge headache.
Alright I will give that a shot and get back to you ASAP On Wednesday, July 11, 2012 3:51:17 PM UTC-4, Nobu Games wrote: Something before or after these two lines must be syntactically incorrect like a missing opening or closing bracket for example. It is usually next to impossible that Eclipse is wrong about that. However, what I noticed since the latest ADT Rev 20 update is that Eclipse quite often does not refresh its error markers anymore after editing / fixing problems. You may want to clean the project and look whether the syntax error messages are gone then. On Wednesday, July 11, 2012 2:37:58 PM UTC-5, Cythes wrote: For some reason eclipse thinks the ()'s are wrong. Here is the code for that part... notifyDetails.setLatestEvent(Infocontext, contentTitle, contentText, intent); mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails); Any idea what can be causing 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] Re: Some Silly error, tailed with a huge headache.
Nothing changed actually On Wednesday, July 11, 2012 3:57:25 PM UTC-4, Cythes wrote: Alright I will give that a shot and get back to you ASAP On Wednesday, July 11, 2012 3:51:17 PM UTC-4, Nobu Games wrote: Something before or after these two lines must be syntactically incorrect like a missing opening or closing bracket for example. It is usually next to impossible that Eclipse is wrong about that. However, what I noticed since the latest ADT Rev 20 update is that Eclipse quite often does not refresh its error markers anymore after editing / fixing problems. You may want to clean the project and look whether the syntax error messages are gone then. On Wednesday, July 11, 2012 2:37:58 PM UTC-5, Cythes wrote: For some reason eclipse thinks the ()'s are wrong. Here is the code for that part... notifyDetails.setLatestEvent(Infocontext, contentTitle, contentText, intent); mNotificationManager.notify(SIMPLE_NOTFICATION_ID, notifyDetails); Any idea what can be causing 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] Do services run in the background?
What I mean by this is that I have an app that I want to to kill the GUI on or have it run in the background. What is the best way to go about doing this? How do I make my app run constantly? But not apparent to the users? -- 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] Volume Button Source Code: Where do I find it?
Where with in the android source code(files) would I go about finding the volume button codes? I am looking to write a patch for an app I am working on. -- 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