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:

flipper=(ViewFlipper)findViewById(R.id.details);


Here is my new code:

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


thanks
--~--~---------~--~----~------------~-------~--~----~



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...

http://dl.dropbox.com/u/1676562/NotificationIssue.mov

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

Setting the notification:

Code:
        // The PendingIntent to launch our activity if the user selects this
        // notification
        final Intent notificationIntent = new Intent(ManagerFactory
                .getMasterActivity(), MailerActivity.class);
        notificationIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_SINGLE_TOP);
        Log.d(TAG, "Set new message to Notification: " + p_message);
        notificationIntent
                .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);

        notification.setLatestEventInfo(ManagerFactory.s_service,
p_tickerText,
                p_message, contentIntent);
Reacting on the incoming intent:

Code:
/*
     * (non-Javadoc)
     *
     * @see android.app.Activity#onNewIntent(android.content.Intent)
     */
    @Override
    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));
            this.showLongMessage(extras
                    .getString(Constants.NOTIFICATION_EXTRA_KEY));
        }
    }

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

Sascha

-- 

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
  <note>
    <to>Danny</to>
    <from>Jane</from>
    <subject>Hello</subject>
    <body>How are you doing?</body>
  </note>

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??