Wednesday, April 24, 2013

[android help] Android ListView - change background of element based on values


I have a list which lists EXPENSES and INCOMES. I want ListViewer to automatically change background to either green for Incomes or red for Expenses, would this be possible?



.

stackoverflow.comm

[android help] NoSuchFieldError on findViewById()


There's two android projects I want to merge, one is Main and the other is linked as Library. But I have some troubles on this line:



Button modificarC;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_menu_calificaciones);
modificarC = (Button) findViewById(R.id.btn_aseso); //HERE


I tried Project Clean... also I have android-support-v4.jar on my dependencies


And this is my trace:



04-24 19:39:52.568: E/AndroidRuntime(9486): FATAL EXCEPTION: main
04-24 19:39:52.568: E/AndroidRuntime(9486): java.lang.NoSuchFieldError: com.utez.sistemas.sam.R$id.btn_aseso
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.utez.sistemas.sam.calificaciones.CalificacionesActivity.onCreate(CalificacionesActivity.java:67)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.Activity.performCreate(Activity.java:4465)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1932)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.access$600(ActivityThread.java:127)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.os.Handler.dispatchMessage(Handler.java:99)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.os.Looper.loop(Looper.java:137)
04-24 19:39:52.568: E/AndroidRuntime(9486): at android.app.ActivityThread.main(ActivityThread.java:4507)
04-24 19:39:52.568: E/AndroidRuntime(9486): at java.lang.reflect.Method.invokeNative(Native Method)
04-24 19:39:52.568: E/AndroidRuntime(9486): at java.lang.reflect.Method.invoke(Method.java:511)
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
04-24 19:39:52.568: E/AndroidRuntime(9486): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
04-24 19:39:52.568: E/AndroidRuntime(9486): at dalvik.system.NativeStart.main(Native Method)


Also here is the layout:



style="@style/LoginFormContainer"
android:layout_width="253dp"
android:layout_height="260dp"
android:layout_marginLeft="15dp"
android:layout_marginTop="30dp"
android:orientation="vertical" >

android:id="@+id/btn_alta"
android:layout_width="match_parent"
android:layout_height="63dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:background="@drawable/btn_altacalif"
android:contentDescription="@string/action_sign_in_register"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:textAlignment="center" />

android:id="@+id/btn_aseso"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="5dp"
android:layout_weight="0.16"
android:background="@drawable/btn_modcalif"
android:contentDescription="@string/action_sign_in_register"
android:paddingLeft="32dp"
android:paddingRight="32dp"
android:textAlignment="center" />




.

stackoverflow.comm

[android help] AsyncTask will always run even if app is destroyed?

android - AsyncTask will always run even if app is destroyed? - Stack Overflow








Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















i have an application and because you cant do network operations on the main thread im using AsyncTask, so the question is once i execute() the AsyncTask right after that i finish() the activity, and maybe the user will finish() the whole app, so what im wondering is:


  1. will AsyncTask always finish doInBackground() and onPostExecute() even if the app is closed as long as execute() was called when the app was running?

























You will be able to test this. And yes It does. If execute was called you can see Asynctask will still execute UNLESS it does something to the forground or UI related. (it may cause launcher to crash).



However, if it was close by the system. It may or may not continue executing the method. I have already tested and answered here.























onPostExecute() is called from the UI thread - so if the UI thread is no longer running, it will not continue to run. However doInBackGround() is ran from a separate worker thread so it will keep on until done (or if the JVM process is killed by the OS, which is also a possibility). Note that AsyncTasks are only recommended for shorter UI-bound background tasks and not long-running background work (a few seconds).


In short, you can not assume that it will keep on and definitely not assume that it will post it's progress or the calling of onPostExecute().




















default







.

stackoverflow.comm

[General] Transition from iOS to Android - Seeking Experts


OK So here is the deal. I've owned iPhone's since the first one. I would consider myself a VERY advanced user on iOS. I am very close to making the leap from iOS to Android, namely because the HTC ONE is just super sexy and exudes all of the things I love about Apple. I've always told myself that I would love to mess around with Android but wouldn't buy a plastic phone that I can flex in my hand. The HTC ONE has finally come along to make this a reality.

iPhones are very restrictive if you don't jailbreak them, however, once Jailbroken there is basically nothing you can do on Android phone that you can't do on an iPhone. In fact, given my limited knowledge on Android devices, the iPhone can do a few things that I don't know if Android can do. Thus this thread. I want to find out if Android can do some of these things and get as much information as I can before I make the dive.

I hope there are people on this forum with great knowledge of both iOS and Android that can help answer some of these questions. If you don't have great knowledge of th iOS Jailbreak community then you probably can't answer some of my questions.

First things first. I understand that you can unlock the bootloader on many Android phones. It sounds like you currently can do this on the HTC ONE and that unless AT&T patches it soon, when I make my purchase I should be able to do this right away. Does this include unlocking the phone? Can unlocking the phone be done via software? This isn't a huge concern but traveling would be much easier if the answer is yes. Once I have unlocked the bootloader, I understand I can load custom ROMs as they are released for the phone. However, right away I should be able to load custom "launchers" correct? Not sure if I'm using the correct terminology there. Obviously I need some information on this.

Also, what will be the best way to transfer my contacts? I understand that this should be simple, just want everyones feedback on this. Can I simply export them via Bluetooth?

Now on to the more difficult questions. First off. I play a lot of online games where you create an account and then your app is tied to that account. A few examples are like the "Storm8" games that are on iOS and Android as well as Dark Summoner which I know is on both. Puzzle & Dragons is another great example. I currently have multiple iteration's of "Puzzle and Dragons" running on my iPhone with multiple user accounts so that I can have multiple characters in that game. Can this be done with Android?

The best thread I found on this is here

However it doesn't look like this is possible. Then someone came along with an idea to rename the .apk and it looks like there may be hope. Hoping some folks can shed some light on this here and if not I might tread over there to see if they can help.

Is there an Android equivalent to iFile? iFile is a great tool on iOS that makes doing the above possible. Browsing throughout the iOS file system to do all kinds of things. I am really hoping there is an equivalent app for Android.

Other apps that I am wondering about equivalent apps to:

MyWi - tethering app made very easy. I don't want to pay AT&T for tethering my phone. I assume android has this but is it through Google Play or do I load another less official app sore to get this?

Also apps like "Fake location" where you can change where you are in case an app doesn't like to function based on where you are located. Sends a different location to an individual app to fake it out.

iBlacklist - as i understand Android does have blacklist apps so you can block certain numbers from bothering you and sending them strait to voicemail.

XBMC - I'm sure android has this, i think it was on Android first.

Game Emulators and ROMs - I'm also sure android has this as the same developers have made them for both. Again, do I get these through Google play or alternative means.

Is there an equivalent to Cydia, where developers can kind of submit there stuff and you can add different sources to get material or is it all through seperate app stores.

I know i have a lot more questions but this is a good start. Please post away.



.

forum.xda-developers.com

[General] Hotspot icon (orange circle)


One thing that bugs me about my HTC Inspire is that if I walk by a hotspot, I will get the orange circle icon at the top of the screen.
The problem is, it won't go away by itself, even if I walk away, or even if I repower the phone.

I don't need to see that icon. I've already disabled wifi notifications but it still appears.

I could live with the orange icon appearing, but it should also go away when I walk away.



.

forum.xda-developers.com

[General] stuck on tmobile contract?


ive looked around a lot for a answer to this question but i havent found anything so im gonna ask you, i recently signed a contract with tmobile in december,and i purchased a galaxy s3, but since i cracked it a little bit and i like the htc one and the new simple choice plan, is it possible i can just "switch" over to the simple choice plan? Would i have to buy out from my current contract and pay like 200 dollars?If i were to switch to the simple choice plan it would be cheaper and i would own a better phone. Please answer



.

forum.xda-developers.com

[General] Outlook for Mac Calendar with Galaxy S3 calendar


First off; Sorry if this has been posted before.

I have a mac with Outlook for MAC 2011 on it. I have had a GS3 for almost a year (made the switch from BB). Since I made the switch I have not been able to get my calendar (or anything for that matter) to sync. Google Sync is no longer an option. I am not too worried about contacts, as they have all been uploaded etc... but can anyone tell me how I can sync my calendar with google calendar, or with my phone calendar?

Thanks in advance



.

forum.xda-developers.com

[General] Creating cool home screens


Most screens are just nice wallpaper and well chosen widgets, none of which requires rooting.

You can make your life easier with a new launcher, which allows you to customizethe layout and orientation of the home screen/screens.

Now go forth and research!

Sent from my Nexus 4 using Android Central Forums



.

forum.xda-developers.com

[General] Dropbox, Android with Windows 8


Any of you Android users out there that use dropbox and on your PC also?

I am trying to use an excel sheet which I had pinned to the taskbar above excel

Well, I had to move the sheet I am speaking of to dropbox folder, and now it no longer stays pinned to excel on the taskbar

Any help with this would be appreciated

(as an addendum, if anyone has a link to iphone 5 alerts, not ringtones, I'd be grateful as well)



.

forum.xda-developers.com

[android help] Android SampleBrowserPlugin Installation failed


I am trying to install the samplebrowserplugin given in the android source code. As given here (https://github.com/android/platform_development/tree/master/samples/BrowserPlugin), I am able to follow it to the second step (make SampleBrowserPlugin). I have the .apk file now but when I try to install it using adb, all I get is



Failure [INSTALL_FAILED_DEXOPT]


When I run logcat, among various messages, I see



DexOptZ: zip archive '/data/app/com.android.sampleplugin-1.apk' does not include classes.dex


.

stackoverflow.comm

[android help] ProgressDialog not showing up despite show() is called


I've got a strange problem, a Dialog being created and called for "show()" but not being visible in my activity...


The thing is it goes through the call "show", I've seen it in the debugger, but nothing...


here is the code:



protected void initializeSpinners() {
spnPlayLists = (Spinner) findViewById(R.id.spnLists);
spnProviders = (Spinner) findViewById(R.id.spnProvider);
spnProviders.setOnItemSelectedListener(new OnItemSelectedListener() {

@Override
public void onItemSelected(AdapterView _spinner, View _parent,
int _pos, long _id) {
if (_spinner == spnProviders) {
String[] playListsId = core.getAllPlayListsFrom(_pos);
int items = playListsId.length;
**showProgressDialog(items);**
String[] playListsNames = new String[items];
String[] playListsThumbs = new String[items];
playLists = new PlayList[items];
for (int i = 0; i < items; i++) {
String id = playListsId[i];
PlayList playList = core.getPlayList(id, true);
playLists[i] = playList;
playListsNames[i] = playList.title;
playListsThumbs[i] = playList.thumb;
handle.sendEmptyMessage(i);
}
loadPlayLists(playListsNames, playListsThumbs);
myPd_bar.dismiss();
}
}

@Override
public void onNothingSelected(AdapterView _arg0) {
}

});

ProvidersArrayAdapter providersAdapter = new ProvidersArrayAdapter(this);
spnProviders.setAdapter(providersAdapter);
}


and the function called up:



private void showProgressDialog(int _items) {
handle = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
myPd_bar.setProgress(msg.what + 1);
}
};

myPd_bar = new ProgressDialog(Intro.this);
myPd_bar.setMessage("Loading....");
myPd_bar.setTitle("Please Wait..");
myPd_bar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
myPd_bar.setProgress(0);
myPd_bar.setMax(_items);
**myPd_bar.show();**
}


what am I doing bad...?



.

stackoverflow.comm

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...