doofin
doofin

Reputation: 498

eclipse android sdk does not update code after changes

problem:

nothing seems to be wrong,no any error infomation,but changes in code no longer takes effect even for the simplest example.i.e:

public void onRadioButtonClicked(View view) {
    // Is the button now checked?
    boolean checked = ((RadioButton) view).isChecked();
    
    switch(view.getId()) {
        case R.id.rdo_todo:
            if (checked){
                Log.e("actedit", "rdo click22");
                }
            break;
        case R.id.rdo_reminder:
            if (checked){
                TimePickerDialog_doofin.newInstance(0, 10, true)
                .show(getFragmentManager(), "tpddf");
                
            }
            break;
    }
}

add some logger:

public void onRadioButtonClicked(View view) {
    // Is the button now checked?
    boolean checked = ((RadioButton) view).isChecked();
    Log.e("actedit", "rdo click???");
    switch(view.getId()) {
        case R.id.rdo_todo:
            if (checked){
                Log.e("actedit", "rdo click22");
                }
            break;
        case R.id.rdo_reminder:
            if (checked){
                TimePickerDialog_doofin.newInstance(0, 10, true)
                .show(getFragmentManager(), "tpddf");
                Log.e("actedit", "rdo click rm");
            }
            break;
    }
}

when i click the radio buttons,the logger does not show.Other changes in code also didn't take effect in devices.

what i've tried but no effect

I view the source file in disk,it did changed.delete apk from device and reinstall apk in debug mode ,the problem remains. clean project delete . at project's bin folder delete .metadate file and re-import project,still no use!!

my view

there must be some place for eclipse to hide/store the old code,but where is it?? from this link: Java Code not properly updating

If none of these work, then I believe there could be some kind of lock in the file system but i have reboot several times,and use vim to see that the source code actually changes

extra info

i use android sdk with eclipse juno.

cause

there were 3 versions of android sdks in computer before:4.2.2,4.4.2,4.4w,i mainly use 4.4.2. yesterday i deleted 4.4.2 sdk and start using 4.4w sdk ,the problem occurs after that.

most weired is:i deleted every file in .metadata and project's own bin folder,but when i ran app,it still give me result from old code !

update

i start a new project,the code is behaves normally,no prob. so i copy old project's bin and src folder to the new one,hope the problem can be solved,but it remains...

Upvotes: 1

Views: 354

Answers (3)

Bartosz Bilicki
Bartosz Bilicki

Reputation: 13235

Do you have Ant/Maven/Gradle build for your project? If yes, then

  1. delete target/bin directories
  2. rebuild from command line (not from IDE)
  3. check that artifact has correct (new) date
  4. redeploy

Upvotes: 0

Bartosz Bilicki
Bartosz Bilicki

Reputation: 13235

Is your function onRadioButtonClicked invoked at all? You may confirm that by debuging.

If you have breakpoint inside onRadioButtonClicked, click radio button and debuger is not stopping- have you assigned onRadioButtonClicked function to your radio (in layout xml file, or in code)?

There are two optons to add listener

Setting radio button listener from xml layout file

android:onClick="onRadioButtonClicked" in your RadioButton tag.

<RadioButton android:id="@+id/radio_pirates"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/pirates"
    android:onClick="onRadioButtonClicked"/>

Setting radio button listener from java code

RadioGroup radioGroup = (RadioGroup) findViewById(R.id.yourRadioGroup);        
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener() 
{
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        // checkedId is the RadioButton selected
    }
});

Upvotes: 0

jonyjm
jonyjm

Reputation: 983

Have you tried a refresh on the entire project, and after that, make a clean.

In eclipse: Project -> Clean -> Clean all projects.

Then, run your app again.

Upvotes: 1

Related Questions