2012/03/29

Android Theory

I've been delving around in Android and Java help materials - tutorials, guides and forums - to help me put together this part of the app.

So, here's the first thing that I've found out, from the official guide to developing for Android here:

An activity represents a single screen with a user interface.
That means I don't want WeddingLogisticsActivity to be a big thing - I want to deal with something called, I don't know, SplashScreenActivity (now referred to as SSA) which is aimed purely at this initial screen of the app.
[Note for future reference - I will probably want a test so that SSA only runs the first time you open the app. Easiest thing that occurs to me is to check whether the variable WeddingDate is empty; if it is, run SSA, otherwise don't. That should avoid problems.]

Looking in more detail at this page, I think the way to proceed is to tell WLA to start an activity called SSA, in the terms
Intent intent = new Intent(this, SignInActivity.class);
startActivity(intent);
Or in my case:
        Intent intent = new Intent(this, SplashScreenActivity.class); 
        startActivity(intent);
Then I set up the beginnings of the new Activity for SSA in the same way; only to realise that I need to put SSA in its own file, called (logically enough) SplashScreenActivity.java as otherwise the app would get confused.
Now, I'm still seeing an error in WLA on the line Intent intent etc, as the app doesn't seem to recognise it; so I tried adding an import statement as below:
import android.content.Intent;
which solved the problem.
Import statements are my friend.

Right, in the classic way of things, it is past time to post this, and I still haven't solved the original problem. Tomorrow, I promise!

No comments:

Post a Comment