Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in tablet #18

Closed
shalommelamed opened this issue Aug 3, 2013 · 2 comments
Closed

Crash in tablet #18

shalommelamed opened this issue Aug 3, 2013 · 2 comments

Comments

@shalommelamed
Copy link

Hey, I'm using the unified preference and it works perfectly fine in two of my devices (smasung galaxy s2 and nexus 4) but when i try it on my galaxy tab it has an exception in the line:
super.onCreate(savedInstanceState);

the exception log:
08-03 22:06:08.619: E/AndroidRuntime(16620): FATAL EXCEPTION: main
08-03 22:06:08.619: E/AndroidRuntime(16620): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.out.goout/com.out.goout.SettingsActivity}: android.app.Fragment$InstantiationException: Unable to instantiate fragment net.saik0.android.unifiedpreference.demo.DemoUnifiedPreferenceActivity$GeneralPreferenceFragment: make sure class name exists, is public, and has an empty constructor that is public
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.ActivityThread.access$600(ActivityThread.java:140)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.os.Handler.dispatchMessage(Handler.java:99)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.os.Looper.loop(Looper.java:137)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.ActivityThread.main(ActivityThread.java:4895)
08-03 22:06:08.619: E/AndroidRuntime(16620): at java.lang.reflect.Method.invokeNative(Native Method)
08-03 22:06:08.619: E/AndroidRuntime(16620): at java.lang.reflect.Method.invoke(Method.java:511)
08-03 22:06:08.619: E/AndroidRuntime(16620): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
08-03 22:06:08.619: E/AndroidRuntime(16620): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
08-03 22:06:08.619: E/AndroidRuntime(16620): at dalvik.system.NativeStart.main(Native Method)
08-03 22:06:08.619: E/AndroidRuntime(16620): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment net.saik0.android.unifiedpreference.demo.DemoUnifiedPreferenceActivity$GeneralPreferenceFragment: make sure class name exists, is public, and has an empty constructor that is public
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.Fragment.instantiate(Fragment.java:584)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.preference.PreferenceActivity.switchToHeaderInner(PreferenceActivity.java:1230)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.preference.PreferenceActivity.switchToHeader(PreferenceActivity.java:1263)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.preference.PreferenceActivity.onCreate(PreferenceActivity.java:630)
08-03 22:06:08.619: E/AndroidRuntime(16620): at com.out.goout.SettingsActivity.onCreate(SettingsActivity.java:19)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.Activity.performCreate(Activity.java:5163)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2061)
08-03 22:06:08.619: E/AndroidRuntime(16620): ... 11 more
08-03 22:06:08.619: E/AndroidRuntime(16620): Caused by: java.lang.ClassNotFoundException: net.saik0.android.unifiedpreference.demo.DemoUnifiedPreferenceActivity$GeneralPreferenceFragment
08-03 22:06:08.619: E/AndroidRuntime(16620): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
08-03 22:06:08.619: E/AndroidRuntime(16620): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
08-03 22:06:08.619: E/AndroidRuntime(16620): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
08-03 22:06:08.619: E/AndroidRuntime(16620): at android.app.Fragment.instantiate(Fragment.java:574)
08-03 22:06:08.619: E/AndroidRuntime(16620): ... 18 more

my code is:

import com.actionbarsherlock.view.MenuItem;

import db.GlobalSettings;

import net.saik0.android.unifiedpreference.UnifiedSherlockPreferenceActivity;
import android.content.Context;
import android.os.Bundle;

public class SettingsActivity extends UnifiedSherlockPreferenceActivity
{
@OverRide
protected void onCreate(Bundle savedInstanceState)
{
setHeaderRes(R.xml.pref_headers);
setSharedPreferencesName("com.out.goout_preferences");
setSharedPreferencesMode(Context.MODE_PRIVATE);
super.onCreate(savedInstanceState);

    try 
    {
        getSherlock().getActionBar().setTitle(R.string.title_activity_settings);
        getSherlock().getActionBar().setHomeButtonEnabled(true);
        getSherlock().getActionBar().setDisplayHomeAsUpEnabled(true);   
    }
    catch (Exception e) {}
}

@Override
public boolean onOptionsItemSelected(MenuItem item) 
{
    if(item.getItemId() == android.R.id.home)
    {
        handleFinish();
        finish();
    }
    return super.onOptionsItemSelected(item);
}

/**this method get the name and the */
private void handleFinish()
{
    try 
    {
        if(!GlobalSettings.getSettings(getApplicationContext()).isUserDetSent())
        {
            String age = GlobalSettings.getSettings(getApplicationContext()).getUserAge();
            String gender = GlobalSettings.getSettings(getApplicationContext()).getUserGender();

            if(!age.equals("") && !gender.equals(""))
            {
                //send the details to the server
                GlobalSettings.getSettings(getApplicationContext()).setUserDetSent(true);
            }
        }
    }
    catch (Exception e){}
}

@Override
public void onBackPressed() 
{
    handleFinish();
    super.onBackPressed();
}

}

your help is much needed.
Thanks in advance.

Best,
Shalom Melamed

@mcsarge
Copy link

mcsarge commented Nov 15, 2013

Any progress on this. It does the same on an Asus TF300.

@shalommelamed
Copy link
Author

yes, I did had progress with that... I didn't use it.
Just use the regular SherlockPreferenceActivity.
Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants