how do I extract an AttributeSet from an xml file

by Andy Droid » Fri, 04 Sep 2009 09:33:31 GMT

Sponsored Links
 I would like to extend ViewFlipper, so that I can override some of the
functions.  I borrowed some code from the Flipper Demo in Murphy's
Busy Coders book.

I made my own class that extends it, but I have to pass in an
AttributeSet, when I instantiate it.  How do I get that from my xml?

Here is the original code:


Here is my new code:

AttributeSet myAttributeSet  = ??;
myExtendedViewFlipper flipper = new myExtendedViewFlipper ( this,


Other Threads

1. Click on Notification does not work as expected... (see screencast!):(

Hi guys,

first of all - Merry Christmas!!!

I have a strange problem here and spent too many hours figuring out
what the problem might be. I definitely need your help here now... I'm
pretty sure this is very easy to fix... if you know how...

I develop a little free app for German O2 customers so that they can
send their 50 free Web-SMS directly from their Android phone and not
only via web interface like O2 wants them to. These SMS are sent in
the background using a service. This service generates notifications
(e.g. Message sent successfully, Login successful/failed,...)

When I click on that notification the app should open and then display
the notification message. This works pretty fine as long as the app is
visible (foreground/active). When putting the app into the background
it's getting launched as well, but it doesn't display the message...
then, when I hold down the HOME-Key and select the app... the message
gets displayed.

See the following video... to show you what I mean...

I'm pretty sure it has something to do with the Fflags for my intent,
so here's my code:

Setting the notification:

        // The PendingIntent to launch our activity if the user selects this
        // notification
        final Intent notificationIntent = new Intent(ManagerFactory
                .getMasterActivity(), MailerActivity.class);
                | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        Log.d(TAG, "Set new message to Notification: " + p_message);
                .putExtra(Constants.NOTIFICATION_EXTRA_KEY, p_message);
        Log.d(TAG, "Setting requestCodeToFixNotificationBug: "
                + s_requestCodeToFixNotificationBug);
        final PendingIntent contentIntent = PendingIntent.getActivity(
                ManagerFactory.s_service, s_requestCodeToFixNotificationBug++,
                notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);

                p_message, contentIntent);
Reacting on the incoming intent:

     * (non-Javadoc)
     * @see
    protected final void onNewIntent(final Intent p_intent) {
        // when called via notification, get the extras
        Log.d(TAG, "Called onNewIntent...");
        final Bundle extras = p_intent.getExtras();
        Log.d(TAG, "Extra: " + extras);
        if (extras != null
                && extras.getString(Constants.NOTIFICATION_EXTRA_KEY) != null
                && !extras.getString(Constants.NOTIFICATION_EXTRA_KEY).trim()
                        .equalsIgnoreCase("")) {
            Log.d(TAG, "Extra:"
                    + extras.getString(Constants.NOTIFICATION_EXTRA_KEY));

Would be great if someone was able to help me...



2. How to display XML

Hi all,

Is it possible to display an xml file with all the tags in Webview or the
Browser without first parsing the xml file?
For example, is it possible to display the following
    <body>How are you doing?</body>

without it being parsed to display

Danny Jane Hello How are you doing?

Any help will be appreciated.

3. TableLayout will not draw new row addition

4. File access from computer? (possible?

5. How Does HttpURLConnection work

6. Perkenalan + pertanyaan :)

7. how to add search box on google map??