> http://code.google.com/p/android/issues/detail?id=2373
> Which is mentioned in comment #5 of the issue that I supplied

Yes. Thank you.

I implemented the changes in Notepad:

1. Inserted
            <activity android:name=".StartupActivity"
                android:configChanges="orientation|keyboardHidden"
                android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category
android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
to AndroidManifest of Notepad

2. Remove
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
from
<activity android:name="NotesList"

3. Insert
    <uses-permission android:name="android.permission.GET_TASKS" />

4. Copy StartupActivity.java to NotePad\src\com\example\android
\notepad

5. Change Package name, change
new Intent(StartupActivity.this, MainActivity.class);
to
new Intent(StartupActivity.this, NotesList.class);

Just a summary: StartupActivity.needStartApp does something like:
getSystemService(Context.ACTIVITY_SERVICE);
tasksInfo = getRunningTasks(1024);
size = tasksInfo.size();
for (int i = 0; i < size; i++) {
  if
(ourAppPackageName.equals(tasksInfo.get(i).baseActivity.getPackageName()))
{
      return tasksInfo.get(i).numActivities == 1;

So, now the question is: how to get rid of GET_TASKS?

1. I am thinking whether it is possible to use a static variable to
keep track of running NotesList activity:
increment the variable in NotesList.onCreate and
decrement  the variable in NotesList.onDestroy
Then instead of calling StartupActivity.needStartApp simply compare
the variable with 0.

2. Or change some Intent flags, as you suggested before.

So, what is the most proper way in your opinion?

Thank you
John

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to