Question

I am new to Android Development. I recently created a slideshow live wallpaper which would change the image in every a few seconds depending on the user's selection. I also added the login, create password, etc. as learning purpose.

I have not seen this message before until I just updated the Eclipse. I am not if it has to do with Eclipse or my codes. This app crashes on my Galaxy Note 2 sometimes. There must be something wrong with the codes, but I can't figure out what causes it....

I read about Asyntask, but I don't know how to approach it.

Could you someone please help me on this?

Thank you.

prefs class:

public class prefs extends PreferenceActivity implements
SharedPreferences.OnSharedPreferenceChangeListener {

private SharedPreferences mSharedPreferences;
private CheckBoxPreference pref_checkbox;
protected static final String TAG = null;

@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    getPreferenceManager().setSharedPreferencesName(main_activity.SHARED_PREFS_NAME);
    addPreferencesFromResource(R.xml.wallpaper_settings);

    getPreferenceManager().getSharedPreferences()
            .registerOnSharedPreferenceChangeListener(this);

I have a bunch of these codes for different buttons just right below the above Oncreate. Is it the cause of the frame skipping problems or anything wrong with them?

  Preference button1 = (Preference)findPreference("button1");
  button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference arg0) { 
                //code for login_password   
                return true;
            }
        });


  Preference button2 = (Preference)findPreference("button2");
  button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference arg0) { 
                //code for create_password   
                return true;
            }
        });



  Preference button3 = (Preference)findPreference("button3");
  button.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference arg0) { 
                //code for reset_password   
                return true;
            }
        });

So on....

Edit: fixed errors.

Was it helpful?

Solution

I had a similar issue when I started with Android development. The app crashed everytime I called drawBitmap, or something like rotate an image. I had to move everything that manipulated images to an asynctask, and the app worked well after. Perhaps this is a solution for you as well?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top