Custom view and making preferences!!

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Custom view and making preferences!!

Postby isaackearl » Thu Dec 04, 2008 12:40 am

hey I am having some issues, I'll try and give as much info as possible but i just don't understand why my code won't work.

I have a main class, that starts a custom view I have called DrawView... with a setContentView() etc... in that DrawView I have some little images that bounce around the screen using onDraw() and invalidate()... this all works great. Now I'm trying to make a preferences view that comes up when I select a menu option... In my main class I make a menu option that bring up a preferences button then it runs the method
startActivity(new Intent(this, Preferences.class));

my preferences class looks like this and works if I just make a whole new project that only runs this class

public class Preferences extends PreferenceActivity implements OnSharedPreferenceChangeListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.layout.settings);
}

public void onSharedPreferenceChanged(SharedPreferences arg0, String arg1) {
// TODO Auto-generated method stub

}

}

problem is it crashes right when I hit my preferences button.

if I run the code startActivity(new Intent(this, Main.class)); instead of Preferences that works fine... it restarts the app

My only theory is that I'm missing some fundamental knowledge about how draw
ing graphics.. and my custom view isn't letting me jump to my preferences.

I may be speaking total nonsense.. but if anybody can decipher what I'm asking then any help would be appreciated, thanks in advance.

isaac
isaackearl
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Nov 25, 2008 8:09 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests