|
That sounds perfect, but I can't get it to work. It restarts the server and shows up under 'adb devices', but 'adb connect' complains about multiple devices and as soon as I unplug the USB, the tcp device drops off the list. I've got a rough idea of where they're getting hung up and I think I can get it figured out from the firmware side. Thanks for the help!
|
# ? Nov 21, 2013 18:36 |
|
|
# ? May 27, 2024 03:17 |
|
I'm learning Android and I'm doing a thing with Services and Activities. Activity A has an integer input field and a button. When the button is pressed, the activity starts a service that creates an alarm with time based on the input field. The alarm then triggers Activity B. I've run into a snag where Activity B gets triggered after around 2 seconds no matter what's in the input field. code:
|
# ? Nov 22, 2013 16:23 |
|
That call to alarmManager.set needs a time including system.currentmilis. Right now you are telling it to start 2 seconds after new years 1970.
|
# ? Nov 22, 2013 17:26 |
|
I rewrote my stupid thing to use OTG instead of AOA, got the demo ready. I guess this is an Android internals question, but where does power drawn from the dc/dc converter in OTG show up in the Settings Battery monitor? From a test we did earlier this week it looks like it's shown under "Wifi" for whatever reason. I'm sucking half an amp out of this thing, it's a large amount of power and I can't imagine it isn't noticing.
|
# ? Nov 22, 2013 22:25 |
|
So now that there's an ActionBar in the support library is there any reason to use ActionBarSherlock?
|
# ? Nov 23, 2013 06:22 |
|
NoDamage posted:So now that there's an ActionBar in the support library is there any reason to use ActionBarSherlock? Not really, I've converted several ABS projects to ABC and haven't run into any serious issues. It's a little more annoying to work with, like you have to use MenuItemCompat instead of the full-replacement MenuItem ABS has. Really though, both libraries require a few weird changes (Window flags have a duplicate replacement in ABS, *Compat helpers in ABC, ect). Once you get past that it's pretty easy.
|
# ? Nov 23, 2013 06:37 |
|
JawnV6 posted:I guess this is an Android internals question, but where does power drawn from the dc/dc converter in OTG show up in the Settings Battery monitor? From a test we did earlier this week it looks like it's shown under "Wifi" for whatever reason.
|
# ? Nov 23, 2013 12:14 |
|
Salvador Dalvik posted:That call to alarmManager.set needs a time including system.currentmilis. Right now you are telling it to start 2 seconds after new years 1970. Thanks, that did the trick. Now I'm trying to extend the project to also update a ProgressBar in the main view, and I have some trouble with that too. I don't really know how I'm supposed to bring a reference to the ProgressBar with me through to the service and on to the BroadcastReceiver. I tried making it static, but then I get a nullpointerexception when I try to access it. Same code as before, the main activity calls a service when a button is called, the service sets an alarm(two now) that's supposed to repeatedly update a ProgressBar until it's full. code:
|
# ? Nov 24, 2013 01:27 |
|
Boz0r posted:Thanks, that did the trick. So just to get it straight, are you sending an update broadcast from the service to the activity? If you are trying to keep the receiver outside the activity, you don't really need to. If you put that ProgressReceiver as an inner class to your Activity or Fragment, you should be able to reference the progressbar directly. You might need to use a Runnable and activity.runOnUiThread(runnable) to make sure you only modify the progressbar on the UI thread or else it might throw an exception. e: Also, you can use Intent.putExtra() to add a real progress percentage to that broadcast, so you don't have to send exactly 10 updates.
|
# ? Nov 24, 2013 02:07 |
|
I'm supposed to do the countdown from the service, so I don't think I can have it as an internal class in the Activity. EDIT: Can I carry a reference to MainActivity through to the service somehow? EDIT: I've come a little further: http://pastebin.kde.org/p3zvxowci I think the only problem left is, that the onReceive doesn't trigger, and I can't see why. Boz0r fucked around with this message at 15:42 on Nov 24, 2013 |
# ? Nov 24, 2013 13:32 |
|
Boz0r posted:I'm supposed to do the countdown from the service, so I don't think I can have it as an internal class in the Activity. At this line in your service: code:
code:
When setting up a broadcastreceiver, you should never need direct contact between the receiver and sender. zeekner fucked around with this message at 18:37 on Nov 24, 2013 |
# ? Nov 24, 2013 18:35 |
|
I've made the changes you mentioned but it still doesn't work This is the revised code: http://pastebin.kde.org/pbbprijzb Do I need to change anything in the manifest file or something? EDIT: If I just invoke sendBroadcast(progressIntent) instead of setting the alarm, it still doesn't work. Boz0r fucked around with this message at 21:19 on Nov 24, 2013 |
# ? Nov 24, 2013 20:42 |
|
I'm not sure why that code isn't working, but I was just able to create a simple broadcast with this:code:
code:
|
# ? Nov 24, 2013 21:30 |
|
I got it working. I don't know how, though. I tried going through the things you did and it worked. Even though I already did the same. Thanks.
|
# ? Nov 25, 2013 11:42 |
|
I have an activity with two different views. If you're on a tablet, the view has two fragments, one of them is a list, and the other is a text field. When you click on an item on the list, it shows some text on the text field. If you're on a phone, the activity only contains the list, and starts a new activity with the text field when you select one. I don't know how to do the second one. I've done the update of the other fragment, but I can't see how I can update a new Activity's Fragment's text field. Here's how I've done the first one, it's in the list fragment: code:
|
# ? Nov 27, 2013 20:24 |
|
Why not pass the text as an extra to the new activity?
|
# ? Nov 27, 2013 21:38 |
|
You might also consider using a ViewPager such that both Fragments are part of the same activity.
|
# ? Nov 28, 2013 00:08 |
|
So I have an app that authenticates the user with a third party website using account information that the user supplies. Right now I am storing their username/passwords in plaintext on the app's internal file storage so they don't have to supply this information every time the app connects to the website. The files are supposed to be private to the application, but I would still like to encrypt the user information because of obvious reasons. Hashing here isn't going to work, because the app has to post the unencrypted passwords to the website, so what is going to be the best way to encrypt and decrypt the data to and from storage? I don't have much experience with cryptography, doubly so with doing it in the context of an android app, so any help would be appreciated.
|
# ? Nov 28, 2013 22:18 |
|
GenJoe posted:So I have an app that authenticates the user with a third party website using account information that the user supplies. Right now I am storing their username/passwords in plaintext on the app's internal file storage so they don't have to supply this information every time the app connects to the website. The files are supposed to be private to the application, but I would still like to encrypt the user information because of obvious reasons. Do you have to present the password with every request? Can't you just save cookies or something similar?
|
# ? Nov 28, 2013 22:48 |
|
Sereri posted:Do you have to present the password with every request? Can't you just save cookies or something similar? No, cookies will keep the user logged in for the current session, so its more an issue of keeping the password stored for subsequent sessions. There are two problems with not storing any user information at all. First is that I don't want the app to prompt the user for a password every time they start the app up again (the entire app revolves around connecting to this website and retrieving data from it, so that would really mess with the user experience). The second is that the app will poll the website at scheduled intervals in the background, so the user will not always be there to supply their information to the app.
|
# ? Nov 28, 2013 23:02 |
|
I feel like I'm losing my mind. I had an application I was working on, and when you started it, onstart was called. When you changed the orientation, onpause and then onresume were called. All was right with the world. Now all of a sudden, onstart is being called when the screen oritentation changes. Any idea what is happening?
|
# ? Dec 6, 2013 23:11 |
|
TheReverend posted:I feel like I'm losing my mind. Are you handling the configuration change by specifying the manifest entry "configChanges=orientation|screenSize|keyboardHidden"? Because without that you should be seeing a full application lifecycle on rotation, from onPause to onDestroy and onCreate back to onResume. One thing that changed is that before 3.x, you only had to specify configChange=orientation|keyboardHidden for that hack to work, but now you have to include screenSize for it to have the same effect. zeekner fucked around with this message at 23:21 on Dec 6, 2013 |
# ? Dec 6, 2013 23:17 |
|
Salvador Dalvik posted:One thing that changed is that before 3.x, you only had to specify configChange=orientation|keyboardHidden for that hack to work, but now you have to include screenSize for it to have the same effect. That's really the default behavior though? I thought it was pause-resume for screen changes. That seems undesirable. Or is it desirable and I'm not doing stuff right? Oh well thank you!
|
# ? Dec 6, 2013 23:24 |
|
TheReverend posted:Well that fixed it. I had orientation|keyboard before you told me to add in screensize. It is a bit of a pain, but you should be using onSaveInstanceState so you can handle the other situations where your activity will be killed and need to be recreated. It's covered in the docs here: http://developer.android.com/guide/topics/resources/runtime-changes.html That rotation hack is legitimately useful, but don't rely on it alone.
|
# ? Dec 6, 2013 23:27 |
|
TheReverend posted:Well that fixed it. I had orientation|keyboard before you told me to add in screensize. It's desirable. Consider the case where you have separate layouts for portrait and for landscape. The safest way to handle this is to recreate the activity and inflate the new layout. If you know you can handle these config changes yourself, you can declare that you do, but you should still be able to recreate your state as appropriate (say the locale changes due to someone's notification's pending intent). See http://developer.android.com/guide/topics/manifest/activity-element.html#config for more great possibilities to your code barfing.
|
# ? Dec 10, 2013 02:18 |
|
Is there a way to get a method invocation from the OS, when a user uninstalls the app, so that relevant files created on the disk can be deleted (like an uninstaller in windows would)?
|
# ? Dec 11, 2013 13:10 |
|
Jarl posted:Is there a way to get a method invocation from the OS, when a user uninstalls the app, so that relevant files created on the disk can be deleted (like an uninstaller in windows would)? Stack Overflow posted:Sadly android at the moment does not give you a possibility to perform code at the moment your app is uninstalled. You could however place your files on the SD card with Context.getExternalFilesDir(). Files in this directory will be removed with the app.
|
# ? Dec 11, 2013 14:43 |
|
Sereri posted:You could however place your files on the SD card with Context.getExternalFilesDir(). Files in this directory will be removed with the app. Thanks. Much better actually.
|
# ? Dec 11, 2013 14:55 |
|
I'm having issues with a MediaPlayer, and I'm hoping somebody in here could shed some light. I've got a viewpager, and when you click on an image displayed in it, it plays an audio file associated with it. While setting it up to stop playing the audio if you go to the next page, I ran into some errors. Stackoverflow (unsurprisingly) has like 300 conflicting opinions on what the proper way to stop and start playback is for MediaPlayers, so I have less of an idea of what's needed then I did going in. Could somebody please help me figure out if there's just some specific configuration of .stop() .reset() .release() .prepare() and .start() I need? From what I can tell, I basically want: code:
code:
Attempting to use stackoverflow solutions ended with me getting null pointer exceptions or state errors, and the MediaPlayer state diagram (http://developer.android.com/reference/android/media/MediaPlayer.html#StateDiagram), while interesting and informative, didn't actually help me understand where and what I needed to call when stopping and starting.
|
# ? Dec 12, 2013 00:04 |
|
surc posted:I'm having issues with a MediaPlayer, and I'm hoping somebody in here could shed some light. quote:When a MediaPlayer object is just created using new or after reset() is called, it is in the Idle state; and after release() is called, it is in the End state. Between these two states is the life cycle of the MediaPlayer object.
|
# ? Dec 12, 2013 05:15 |
|
I don't know how I missed that when I was going through the documentation, guess I was taking a bit of a mental holiday. Got it working now though, thanks!
|
# ? Dec 13, 2013 00:42 |
|
If you have an activity which is popped (e.g. through back), and you want some part of the UI to remain the same the next time the user returns, although it should be reset when the app is actually restarted (i.e. a new task), then what is the best way to go about that? onSaveInstanceState() is not the way since it is not a kill or device configuration change that is a problem (although this should also be supported, that is a different matter). Using PreferenceManager doesn't seem the right way to go about it, since when the app is restarted then the UI in the activity should go back to default.
|
# ? Dec 13, 2013 15:39 |
|
Jarl posted:If you have an activity which is popped (e.g. through back), and you want some part of the UI to remain the same the next time the user returns, although it should be reset when the app is actually restarted (i.e. a new task), then what is the best way to go about that? There might be a better way to do this, but I would probably use onPause() to save the data and use an onCreate() in an Application class, which will be called only when the whole application is created, to set it to the default.
|
# ? Dec 13, 2013 18:26 |
|
I'm having a problem upgrading my app's database. For background, my app's a J-E dictionary that relies on a prepopulated database for its entries, sample sentences, etc... Right now I'm trying to figure out a way to upgrade the database itself with a new one I compiled from updated sources. I have 95% of the upgrade process figured out, but I'm running into a problem where backed up, user-generated information isn't being committed to the new database file. Rather, it looks as though the Content Provider is writing everything to a journal, which is bad because even though the user's content appears to survive the upgrade, force-closing the app blows away the journal file and basically leaves the user with a brand new installation. Here's a high-level breakdown of how I'm handling the database upgrade: 1. Grab three cursors' worth of the user's information from the old database 2. Delete the old database 3. Instantiate a copy of the new database from the Expansion file 4. INSERT or UPDATE the user's information into the new database Here's some actual code used in the SQLiteOpenHelper's OnUpgrade(): Java code:
The weird part is that the createNewTag(), setTagOnWord(), and updateLastViewed() functions are the exact same ones I use elsewhere in the app to commit information to the database. I've verified that any time these functions are called in the course of using the app, the information is committed to the database file itself (I rooted my dev device so I can pull the database straight from the protected directory). It's only during the above upgrade process that the changes are only committed to the db-journal file. What can I do to make this work? IAmKale fucked around with this message at 19:43 on Dec 17, 2013 |
# ? Dec 17, 2013 19:41 |
|
Is the database actually deleted before you close the cursors? Maybe deleting it at the end would work correctly?
|
# ? Dec 17, 2013 19:46 |
|
Cruseydr posted:Is the database actually deleted before you close the cursors? Maybe deleting it at the end would work correctly? That brings up another question I had: when I query the database, does the cursor that is returned contain the data itself, or references to the location of that data in the database?
|
# ? Dec 17, 2013 19:56 |
|
Karthe posted:That brings up another question I had: when I query the database, does the cursor that is returned contain the data itself, or references to the location of that data in the database? That's kind of what I was meaning, maybe it can't be fully deleted until the cursors close. Could you change it so that you make a new database, insert the old data, close the cursors, delete the old database, then rename the new database?
|
# ? Dec 17, 2013 20:25 |
|
Cruseydr posted:That's kind of what I was meaning, maybe it can't be fully deleted until the cursors close. Could you change it so that you make a new database, insert the old data, close the cursors, delete the old database, then rename the new database?
|
# ? Dec 17, 2013 23:20 |
|
I'm trying to use the onSaveInstanceState to save a "camera position" for a small 2D app and retrieve them with onRestoreInstanceState. Stuff are being done in a SurfaceView that implements SurfaceHolder.Callback that starts a thread that does the drawing in the surfaceCreated function. In the onPause function I do setRunning(false). The values get saved and read correctly. But the camera doesn't jump to the saved position until I touch the screen. I've tried resuming the thread that does the drawing in the onResume function and running the surfaceCreated function but nothing puts the camera in the correct position before touching the screen. Does anyone know how to solve this? EDIT: Nevermind, I was just missing a function call . That's what you get for coding non-stop all day. Claeaus fucked around with this message at 23:46 on Dec 22, 2013 |
# ? Dec 22, 2013 22:19 |
|
|
# ? May 27, 2024 03:17 |
|
What's a good way to hardcode a "no ads" mode into my app so that ads are disabled on any device from which I personally run the app? I'm using Admob for ads and allow users to purchase a "no ads" upgrade via IAP. Unfortunately I'm unable to purchase the upgrade because I can't buy things from myself. This makes it impossible for me to run my app without ads unless I run the app in DEBUG mode (since I coded in an exception for that for development purposes), but I want to run the Play Store version on my phone so I can get the end-user experience (I develop on a separate device).
|
# ? Dec 26, 2013 17:34 |