yashsingh1/xdaforums huggingface dataset:
[Fascinate Q&A, Help & Troubleshooting] n3os33k3r:
what version of the kernel are you using? and are you using voodoo control?
[Android Software Development] Futur Innovations:
I'm new to using cursors to obtain data from the device. I'm working on a music player (see market link in signature) and I need to be able to list (and eventually play) the music found on the sdcard. I have some code, but I can't seem to get it to work :(

Here's the code I found on a website, but it leads to a force-close:

public class TestingData extends Activity {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

TextView view = (TextView) findViewById(R.id.hello);

String[] projection = new String[] {

MediaStore.MediaColumns.DISPLAY_NAME

, MediaStore.MediaColumns.DATE_ADDED

, MediaStore.MediaColumns.MIME_TYPE

};

Cursor mCur = managedQuery(Media.EXTERNAL_CONTENT_URI,

projection, null, null, null

);

mCur.moveToFirst();

while (mCur.isAfterLast() == false) {

for (int i=0; i<mCur.getColumnCount(); i++) {

view.append("n" + mCur.getString(i));

}

mCur.moveToNext();

}

}

}

Here's my attempt at fixing it, which still leads to a force-close:

public class test3 extends Activity {

TextView view = (TextView) findViewById(R.id.text1);

ListView list;

private ArrayAdapter<String> adapter;

String[] projection = new String[] {

MediaStore.MediaColumns.DISPLAY_NAME

, MediaStore.MediaColumns.DATE_ADDED

, MediaStore.MediaColumns.MIME_TYPE

};

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

list = (ListView)findViewById(R.id.list);

ArrayList<String> _list = new ArrayList<String>(Arrays.asList(projection));

adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,_list);

list.setAdapter(adapter);

Cursor mCur = managedQuery(Media.EXTERNAL_CONTENT_URI,

projection, null, null,

MediaStore.MediaColumns.DISPLAY_NAME + "ASC"

);

mCur.moveToFirst();

while (mCur.isAfterLast() == false) {

for (int i=0; i<mCur.getColumnCount(); i++) {

view.append("n" + mCur.getString(i));

}

mCur.moveToNext();

}

}

}

What am I doing wrong? Both codes lead to a force-close and I can't think of anything else to do. Thanks in advance.
[Android Software Development] smaskell:
did you set the correct permissions in the android manifest?
[Android Software Development] Futur Innovations:
*slaps hand to forehead* I always forget about the manifest. Lol. Ummmm....what all am I supposed to put in there for these codes? Do both codes look like they would accomplish the same thing?
[Android Software Development] Rootstonian:
Well, I've written hundreds of Cursors in Android and I don't run my loop like you do, so, as a suggestion:

Cursror c = yada, yada;

if(c.moveToFirst()) {
do {
// TO DO HERE...
} while(c.moveToNext());
}
c.close();

Never had a problem.
[Android Software Development] Futur Innovations:
Awesome! Thanks. Ill try it when I get a chance :)
[Captivate Themes and Apps] TRusselo:
awesome!

cant see time of state 100mhz though. if status bar were hidden while app was open it would give that little extra.

Must un-install regular Voltage Control for install to complete. For the best though.
[Captivate Themes and Apps] wonner:
Scheduler is blank with no options in the drop down menu for me.
[Captivate Themes and Apps] shane87:
Hmm, thats odd, as on my Captivate, which I did all of my testing on, the time in state for the 100Mhz state was visible. I know I had that problem on previous builds, but finaly got the layout to work for me. I will look into hiding the task bar to get the extra room for the states to show properly. I am working on a new build anyway, as the cpu threshold settings does is not properly hidden, plus I forgot to have it remove any existing cpu threshold settings when it finds the kernel does not support cpu threshold. Of course, the only time that would be an issue is when changing from a cpu threshold enabled kernel, such as Onix, to a kernel without cpu threshold, such as kb1 beta. Anyway, I hope to have a new version up tonight or tomorrow at the latest.
[Captivate Themes and Apps] shane87:
Hmm, thats odd. Does the original Volatage Control work with your kernel? If it does, I can't understand why the Scheduler settings wouldn't load, as I made no changes to the Scheduler settings implementation. As far as any other feature, and the app in general as well, I can't promise compatibility with any kernels other than those created by existz, and at this time I can't even promise compatibility with suckerpunch-voodoo by existz, as I have done no testing with sp-voodoo yet.
[Captivate Themes and Apps] existz:
Scheduler shows fine for me
[Captivate Themes and Apps] wonner:
Yes, I uninstalled VC 3.0.3 to install your app and scheduler was working fine. Regardless, I uninstalled VC EX and reinstalled it and scheduler is working fine now. I am using Onix, I was just too lazy to change my sig. :p

Great app BTW! :D
[Captivate Themes and Apps] shane87:
Awesome, I'm glad it is working for you now!! I understand about being to lazy to change your sig, I am back on kb1 for now, but I ran onix for about 4 days while testing this app, and never changed my sig. Quick question, can you see the time in state for the 100mhz state? I am planning on a release of the next version, a minor update, tonight or tomorrow. All I am changing in the update is hiding the status bar, cuz someone reported being unable to see the 100mhz time in state, and I have fixed the code to remove the cpu threshold spinner for kernels that don't support it.

ROM: Cognition v4.3

Kernel: eXistZ kb1 beta #8, Voodoo Sound v7, Voodoo Color, Voodoo lagfix

Modem: I897 UCJJ4

HW Build Number: 1101
[Captivate Themes and Apps] alexige:
Running continuum and latest onix everything works fine and I can see everything.
[Captivate Themes and Apps] shane87:
Awesome! I'm glad most of you are having good results with this app! For anyone who is not seeing the time in state for 100Mhz, I am adding the code to hide the status bar, just to give it a little extra room. And I may add an option to switch whether it hides the status bar or not, but I haven't decided yet. I personally like seeing the status bar, but that is simply my opinion. Either way, I will definitely have a new version up some time tonight, as I had to go back and fix a little bug I found. Due to the way I wrote the code for implementing the CPU Threshold spinner, it should have disabled the spinner and hit it if you were running a kernel without CPU Threshold support, but I made a small mistake that proper debugging would have picked up. I have it fixed now, so I will post the new version soon, after I tinker around with hiding the status bar.
[Captivate Themes and Apps] shane87:
Just uploaded 1.01beta! This is a minor update, as all that I changed was how the app checks for support of CPU Threshold settings. This change allows the app to hide the CPU Threshold settings options on kernels that do not implement CPU Threshold settings, such as existz kb1 beta kernel. I am looking into adding an option to make the app full screen, thus getting a little more room on the display for anyone having difficulty seeing the 100Mhz time in state. However, I have been up for 28hrs+ so my mind is not at its best! I will, hopefully, get some work done on this tomorrow. Till then, happy modding.

P.S. For those wondering, I left the original apk up, as the update, 1.01b, only really affects users who do NOT have Onix kernel installed. Plus, I haven't tested the update against Onix kernel yet, as I said above, lack of sleep makes things fuzzy, and I try not to flash when fuzzy. When I get a confirmation, preferably from a few users plus my own tests, that the new version does indeed work on Onix, I may remove the old version.
[Captivate Themes and Apps] shane87:
Ok, so I have been awake for entirely way to long, but before I retire for the night, I realized that neither version of the app had been zipaligned. So I took down the files posted before, renamed everything in a uniform matter, zipaligned both apks, and reposted them. If you have either version installed, you should re-download it, as they run slightly smoother after zipaligning. Nighty night xda! And to everyone, especiall the devs and rom cookers, keep up the good work!
[Captivate Themes and Apps] cucumbersmell:
So far, so good.
[Captivate Themes and Apps] sinichi21:
hmm having trouble with the state when i use cpu spy the there are only 3 available state 800 1000 1300, but when i check on the voltage control ex the other state are check, so im confuse now can someone explain it to me clearly why the other state doesnt show up on cpu spy app? does that mean the other state is not working even its check? And also i cant get the threshold to stick to performance whenerver i try to reboot it always go back to battery saver, im using onix nighty the latest
[Captivate Themes and Apps] shane87:
Hmm, that's very odd. I have checked against cpu spy, and I am seeing the same states enabled in cpu spy as I am in VC EX. Do you have a terminal emulator? If you do, could you run the command

cat /sys/devices/system/cpu/cpu0/cpufreq/states_enabled_table

and give me the output? As far as it not saving the threshold settings, have you saved boot settings? If you don't save boot settings after a change to the Threshold settings, it will not copy the right script over to /etc/init.d
[Captivate Themes and Apps] TRusselo:
the problem might be with larger check boxes or fonts in my rom/theme
[Captivate Themes and Apps] sinichi21:
my frequency is showing now on the cpu spy it's just seems to load slow maybe in 3 mins every states will show from the time or your first boot, but my threshold still wont stick to any of it if i enable the tweak on onix my threshold will be on performance but when i try to save it on battery save and save on boot while the tweak of onix is on after a reboot it will return to performance. but when i disable the cpu tweak on onix it wil stay on battery save and when i save it on performance after a reboot it will stick on battery save. It still depends on the onix setting I think sorry for the bad english I hope you get it
[Captivate Themes and Apps] shane87:
Yeah, it looks like your rom/theme has latger checkboxes. I am running Cog4.3 with the stock theme. Don't worry, I am working on adding a hide status bar option to the main menu, hopefully today I will have it ready for release. I also have another issue I am working on as well, that may take a little figuring to fix, but I hope to have a new update sometime today.

ROM: Cognition v4.3

Kernel: eXistZ kb1 beta #8, Voodoo Sound v7, Voodoo Color, Voodoo lagfix

Modem: I897 UCJJ4

HW Build Number: 1101
[Captivate Themes and Apps] shane87:
I just did a reboot to see if performance or stock would stick on mine at reboot, and it is defaulting to battery saver as well. I think it has something to do with the way existz has the cpu threshold settings applied by the kernel at boot-time. I am working on fixing this as we speak, as well as adding the hide status bar option mentioned in my last post. Hopefully I will have something for release today that addresses both issues. As far as the threshold settings not sticking at boot, just re-apply them after boot and they will stick, untill next boot anyway. And I knew about the threshold settings defaulting to performance when the threshold tweak was activated on onix, I meant to add a note in the op about it, but it slipped my mind. Like I said, I hope to have this fixed today. Until then, just make sure to open vc ex and re apply your settings after a boot. Keep up the good work everyone, and let me know about any and all issues. That's how I know what needs to be fixed to make this app as good as possible!!

ROM: Cognition v4.3

Kernel: eXistZ kb1 beta #8, Voodoo Sound v7, Voodoo Color, Voodoo lagfix

Modem: I897 UCJJ4

HW Build Number: 1101
[Captivate Themes and Apps] shane87:
Ok, so I just confirmed the reason for cpu threshold settings not sticking at boot. As it turns out, the script for applying the cpu threshold settings is not getting called at boot, despite being placed in /etc/init.d. I did not expect that was the case, but it does make my job easier on fixing the issue.
[Captivate Themes and Apps] shane87:
WooHoo! Got the Hide Status Bar and Show Status Bar menu options working! Just finished working on the cpu threshold settings, making them stick at boot. Do far so good, just need to do a little more testing, and will hopefully have an update within the next little bit!
[Captivate Themes and Apps] shane87:
UPDATE!!

Ok, here it is, Voltage Control EX 1.10beta! In this version, I have fixed the cpu threshold settings so they will stick at boot, and added an option to toggle between hiding the status bar. The app will launch with the status bar visible, but by pressing menu>Hide Status Bar, the app will hide the status bar, giving room for those of you who have had issues with seeing all of the time in states strings. The option Show Status Bar does exactly the opposite, showing the status bar, as you would expect. Note that this setting does not stick between launches, as I have not implemented saving states yet, but the option is there to activate now! As always, let me know of any and all issues/bugs you find!!
[Captivate Themes and Apps] harpo1:
Do we need to uninstall the previous version before installing the current one?
[Captivate Themes and Apps] shane87:
You shouldn't need to. I have not uninstalled my app since I started coding on it. It is versioned so that it should install right over top of the old version. If you have any issues with install, let me know, and I will look into it.

ROM: Cognition v4.3

Kernel: Onix 2.0.4, Voodoo Sound v7, Voodoo Color, lagfix

Modem: I9000 tljl3

HW Build Number: 1101
[Captivate Themes and Apps] aalh:
everything works smooth and looks good

is it feasible to have the t-i-s shown as a number OR a percentage?
[Captivate Themes and Apps] shane87:
That is something I had not thought of. If you look at the op, I am working on showing it in hour:minute:second format. I may either add the option to choose time or percentage, or I may just add the percentage in, if there is room for it.

ROM: Cognition v4.3

Kernel: Onix 2.0.4, Voodoo Sound v7, Voodoo Color, lagfix

Modem: I9000 tljl3

HW Build Number: 1101
[Captivate Themes and Apps] shane87:
Ok, so I am working on adding a few things to this app. I have changed the time in state read out to shiw it in hours:minutes:seconds format, and a big thanks to existz for pointing me in the right direction on that. I am also working on adding an option to switch between showing the time in states and the percentage of time spent in each state. I am not sure if I will be able to get a release up tonight or not, I hope I can, but I have to go to work in a little, so I don't know. Also, I am changing the fullscreen option to be one button that changes depending on what the current setting is, i.e. when in normal mode it says "hide status bar" and when in full screen it says "show status bar." Thanks to evryone for your patience with the updates, and a big thanks to everyone who downloads and uses my app!!

ROM: Cognition v4.3

Kernel: Onix 2.0.4, Voodoo Sound v7, Voodoo Color, lagfix

Modem: I9000 tljl3

HW Build Number: 1101
[Captivate Themes and Apps] TRusselo:
there should be at least as many thanks as downloads... common guys..
[Captivate Themes and Apps] shane87:
Well thanks!! So I am not going to get a release up tonight, I still have some stuff to get added and I have to go to my real job. Plus, I have not gotten the time in states as percentage option fully implemented, and I also noticed that, for whatever reason, eclipse is NOT saving any changes I make to the manifest file. So if you look at the version on all of the apk's I have posted, they all still say 3.0.3alpha, aince that was the version of voltage control that I grabed the sources from. So tomorrow, I will be HOPEFULLY getting a working 1.2.0beta up with the added features listed below, plus tye versioning fixed.

Features being added to 1.2.0beta:

Changed tis to hour:minute:second format

Add option to show percentages instead of times in tis

Changed fullscreen options to be one button

Add time in state for deep sleep.

Again, I will NOT be releasing 1.2.0beta tonight, and the changes listed above are NOT available yet! Thanks again to everyone!

ROM: Cognition v4.3

Kernel: Onix 2.0.4, Voodoo Sound v7, Voodoo Color, lagfix

Modem: I9000 tljl3

HW Build Number: 1101
[Captivate Themes and Apps] shane87:
Ok, I have 1.2.0beta almost ready to go! Unfortunately, I don't have time to upload tonight, but tomorrow 1.2.0beta will be up! All of the features mentioned in last post are active, plus I have updated the versioning, and have changed the package name from com.darekxan.voltagecontrol to com.shane87.voltagecontrolex. Look for the update tomorrow morning!

ROM: Cognition v4.3

Kernel: Onix 2.0.4, Voodoo Sound v7, Voodoo Color, lagfix

Modem: I9000 tljl3

HW Build Number: 1101
[Captivate Themes and Apps] shane87:
Update!!!

Ok, so here it is, Voltage Control EX 1.2.0beta! I have made some changes to this one, check the op for details on the changes, but here is a quick rundown:

1. Changed package name from com.darekxan.voltagecontrol to com.shane87.voltagecontrolex.

NOTE!!! This means that you WILL need to uninstall previous version! Well, you don't have to, but if you don't uninstall previous version, you will have TWO VC EX apps installed!

2. Changed the Main Menu to put Show/Hide Status Bar into one option. Now, it has one button that updates depending on which option you have selected.

3. Added a Main Menu option to show Time In States as a percentage. The option updates to allow you to switch back and forth.

4. Added a read out for time in Deep Sleep. Thanks to storm717 for this one, I studied the code for his Cpu Spy app to find out how to do it.

Find the update in the OP!

And a big thanks to all users who use this app, especially those that let me know about bugs!!
[Captivate Themes and Apps] iXNyNe:
I think it would also be appropriate to include the % of time in state.

Add all times, take (time for state A ÷ total time) × 100 and display that before the 00:00:00 output :) should be no issue to display it on the same line (space wise)
[Captivate Themes and Apps] shane87:
I may look at adding that in a future update. In the current version, however, the percentage is included, you simply have to click menu>Show TIS as Percent, then open the States drawer to see the percentages. You can also click menu>Show TIS as Percentage or menu >Show TIS(Which reverts to hour:minute:second format) with the States drawer opened, in which case the info will be updated as soon as you click it.
[Captivate Themes and Apps] iXNyNe:
Right, but to utilize screen real estate you could put under each state rather than

Time in State: h:mm:ss

it could be

Time: hh:mm:ss / xx%

Or

TIS: hh:mm:ss / xx%

This way it frees up a button in the menu for something more useful like reset (once its working)

(Side note I pointed out above that the hour is not currently showing leading zeros for hours under 9, this makes things appear a little inconsistent when some are >10)

Also your about screen still says 1.01b
[Captivate Themes and Apps] aalh:
I was running the version before 1.2b

It may have given me sleep deaths

I undid all changes made since the SD's started, even reflashed the kernel

the only thing that stopped it was replacing VCEX with plain ole VC

I will let me phone run a bit longer to verify, then I will try 1.2b
[Captivate Themes and Apps] shane87:
Hmm, that's odd. I don't understand why VC EX would cause sleep deaths. Unless applying the cpu threshold settings had something to do with it. All of the other features aside from cpu thresh are just informational toops that gather data, but do not modify anything. If you are interested in finding out if cpu thresh settings is to go into recovery, select onix tweaks, and choose the cpu thresh tweak. If it starts acting up again, that is the problem. Either way, let me know how your testing goes! There may be something broken after all, you never know with these cappys! Gotta love samsung quality control, except not!!

ROM: Cognition v4.3

Kernel: Onix 2.0.4, Voodoo Sound v7, Voodoo Color, lagfix

Modem: I9000 tljl3

HW Build Number: 1101
[Captivate Themes and Apps] shane87:
I see what you are saying now. Of course the reset option and any other missing ones are still there, just under the more option, but I see what you are saying. I am looking at redoing the ui a little, but I want to get all of my features added first, so then all I have to do is relayout the ui and not worry about the features. But I will definitely play around with the percent/tis layout. And thanks for pointing out the about screen version mess up. I forgot to change the appversion string! Oops!

ROM: Cognition v4.3

Kernel: Onix 2.0.4, Voodoo Sound v7, Voodoo Color, lagfix

Modem: I9000 tljl3

HW Build Number: 1101
[Captivate Themes and Apps] aalh:
I agree, it can only be the thresh section

unless somehow polling the TIS causes timer confusion which is highly unlikely

I am still not ready to say that is it. although I have not had an SD since I uninstalled EX, I did have a CD just now when it reached 100%

I will keep you updated now that I am starting with a full charge
[Captivate Themes and Apps] TRusselo:
hmm only had one sleep death on onix 2.0.3 before this.. we'll see.

weird though i disabled the 100 mhz step but it is still used. 47%

200,400,600,800,1000 enabled.

4,3,8,19,2 % respectively (plus the 47% 100 that is disabled)
[Captivate Themes and Apps] shane87:
Update!!

Ok, so since it was just pointed out to me, I now feel like an idiot! I have been working on getting the version settings to stick, since eclipse does not want to save the AndroidManifest.xml file when you change it. I got that working, and added all of the features so far, and yet I forgot to update the version shown in the about dialog box! DOH! Ok, so this version is identical to 1.2.0b, and feel free to continue to use 1.2.0 instead of this one, I just need to post it, or I will go nuts! What can I say, I'm ocd. Anyway, the only changes are fixing the version shown in about dialog, having the Visit Us On XDA button bring you here instead of xan's VC thread, and having the "Get A New Kernel" button, the one that is shown when you run this app on an incompatible kernel, take you to existz's Onix kernel, since I built this around Onix. Like I said, use this one or 1.2.0, they both offer the same functionality, I just can't stand to leave mistakes alone!
[Captivate Themes and Apps] shane87:
To aalh, I hope that you figure out what is causing the problems. By any chance, did you delete the S_volt_scheduler file in /etc/init.d or save boot settings from VC before you had the CD? If not, the cpu thresh settings will still be active at boot. Also note that the only way to undo the cpu thresh settings after removing VC EX is to delete S_volt_scheduler, or save boot settings from VC, then reboot. When you reboot, stock settings are restored, then S_volt_scheduler is ran to change the settings. If S_volt_scheduler still has the cpu thresh settings in it, it will reapply them even without having VC EX installed.
[Captivate Themes and Apps] aalh:
I was following that procedure, I treated it like windows ( I rebooted after every change)

I have not had a SD since swapping back to plain VC

I have the CWM threshold tweak enabled

I think it must be some difference in the settings from the onix tweak and the battery saver threshold settings from EX

I will continue EX-less for another day or so to verify