Saving Stats to Textfile

by jh » Wed, 25 Mar 2009 01:33:27 GMT


Sponsored Links
 Hi,

I would be an intermediate level Java programmer (more of a hobbyist).
I want to create an app for android that counts stats during a
football game. This is roughly the functionality:

1.User presses buttons representing each type of stat e.g. #1 for
score, #2 for lost posession of ball etc. (ideally it would be on a
touchscreen phone and the user could use a stylus to touch buttons on
the screen -by the way, would I have to program differently for a
touchscreen? or is that a hardware thing?)

2.Each time a number is pressed, it's written to a text file on the
phone or into a database (sqllite or whatever).

3. the text file can then be sent in a message to another android
enabled phone.


Is all this possible without being an advance Java programmer? Any
guidance would be welcome and I realise this is a broad definition of
the program.

GF

--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Open Browser from Menu

Hello,

Here's what I'm attempting to do. I have a menu, and when a user
selects a particular option in the menu I want the browser application
to open and display the web page. However, I cannot seem to do this.

My application uses a TabWidget to display its content (which works
perefectly) but I cannot for the life of me figure out how to open a
link into the browser. I have tried adding a WebView to the TabWidget
(but when I request it from the view by findViewById(...) I get a
null. I've also tried creating a separte view and performing a
setContentView(...) and then I get an exception. I've also tried using
an intent I've seen demostrated on this group.

It seems like this should be fairly easy, but I must be missing
anything. I've looked at the sample apps as well as the Apps-for-
android samples and have followed them to the T, yet still to no avail
I cannot get the browser to open (or anything like that).

Does anyone have any recommendations/tips/code? Thanks
--~--~---------~--~----~------------~-------~--~----~

2. Bitmap memory leaks with onClick...

Hi All i have strange memory leak with Bitmaps. First what i have - an
activity that based on the workspace view from Launcher ( 3 screens
current prev + next ) . This layout is supplied with adapter , so then
i flipping left/right it loads next view.
The views that adapter is providing is an ImageView (picture) with
decodeBitmap + TextView(Caption).  I also have on click listener that
is set on the views that toggles captions which calls this:

public void onToggleCaption() {
                mAdapter.toggleCaption(); // sets boolean if is should display
caption
                int currentScreen = mImageLayout.getCurrentScreen(); // 
remembers
current screen number.
                mImageLayout.removeAllViews(); // Removes all three children
                mImageLayout.setCurrentScreen(currentScreen); // Set back 
everything
back ( but now adapter will show or hide captions )
        }

When i call this from the menu - everything is just fine. Heap stays
same +/- 1K. If i execute this code via onClick listener - i'm loosing
memory quite quickly and in about 20th iteration - VM out of budget.

adapter.        public View getView(int position, View convertView, ViewGroup
parent) {
                View newView = null;
                byte[] mFullImage;
                Enclosure enclosure = (Enclosure) getItem(position);

                if (convertView != null)
                        newView = convertView;
                else {
                        LayoutInflater layout = LayoutInflater.from(mContext);
                        newView = layout.inflate(R.layout.image_layout, null);

                }
                //TODO - this can be optimized
                ImageView iView = (ImageView) newView.findViewById(R.id.image);
                TextView tView = (TextView) newView.findViewById(R.id.caption);

                Bitmap image = null;
                // mFullImage is a byte[]
                mFullImage = enclosure.getImage();
                if (mFullImage != null) {
                        try {
                                image = 
BitmapFactory.decodeByteArray(mFullImage, 0,
mFullImage.length);

                        } catch (RuntimeException e) {
                                Log.w(TAG, e);
                        }
                }

                if (image != null) {
                        iView.setImageBitmap(image);
                        String caption = enclosure.getContent();

                        if (!caption.equals("") && mShowCaption) {
                                tView.setVisibility(View.VISIBLE);
                                tView.setText(caption);
                        } else {
                                tView.setVisibility(View.GONE);
                        }
                }
                newView.setClickable(true);
                return newView;
}
--~--~---------~--~----~------------~-------~--~----~

3. ActivityMonitor on Android activities.

4. can get the music information?

5. javax.xml.datatype.XMLGregorianCalendar

6. display more than one activity window on device

7. Making a persistant content observer