Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100393777
LauncherActivity.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jan 30, 11:40
Size
1 KB
Mime Type
text/x-java
Expires
Sat, Feb 1, 11:40 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23934759
Attached To
R3229 Genome Privacy - SHCS App
LauncherActivity.java
View Options
package
ch.epfl.pharma
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.AsyncTask
;
import
android.os.Bundle
;
import
android.util.Log
;
public
class
LauncherActivity
extends
Activity
{
private
final
static
String
TAG
=
LauncherActivity
.
class
.
getName
();
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_launcher
);
AppInitializerAsyncTask
initializer
=
new
AppInitializerAsyncTask
(
this
);
initializer
.
execute
();
}
private
class
AppInitializerAsyncTask
extends
AsyncTask
<
Void
,
Void
,
Boolean
>
{
private
Context
context
;
public
AppInitializerAsyncTask
(
Context
context
)
{
this
.
context
=
context
;
}
@Override
protected
Boolean
doInBackground
(
Void
...
params
)
{
Log
.
d
(
TAG
,
"This is the async task handler"
);
try
{
Thread
.
sleep
(
3000L
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
Log
.
d
(
TAG
,
"finished sleeping"
);
return
true
;
}
@Override
protected
void
onPostExecute
(
Boolean
initialized
)
{
if
(
initialized
)
{
// start default activity
Intent
intent
=
new
Intent
(
context
,
MainActivity
.
class
);
startActivity
(
intent
);
}
else
{
// quit program
finish
();
}
}
}
}
Event Timeline
Log In to Comment