Well with the help of people on this forum I recently completed an application and sent it to my boss to test on a phone. (I do not own an android phone )
Anyways when he launched the app it wouldn't work if he clicked the splash screen during its load, meaning the menu buttons would not load the webpages they were intended to. However, if he just let the splash run its course, the app worked fine.
Any ideas??? Because I am not sure where the problem lies, code is posted below for splash screen, menu, and manifest.
Splash Screen
Menu
Manifest
Anyways when he launched the app it wouldn't work if he clicked the splash screen during its load, meaning the menu buttons would not load the webpages they were intended to. However, if he just let the splash run its course, the app worked fine.
Any ideas??? Because I am not sure where the problem lies, code is posted below for splash screen, menu, and manifest.
Splash Screen
Code:
package android.bankclosures;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.content.Intent;
public class SplashActivity extends Activity {
protected boolean _active = true;
protected int _splashTime = 5000;// time to display splash screen in ms
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
// thread for displaying the Splash Screen
Thread splashThread = new Thread() {
@Override
public void run(){
try {
int waited = 0;
while(_active && (waited <_splashTime)) {
sleep(100);
if(_active) {
waited +=100;
}
}
} catch(InterruptedException e) {
// do nothing
} finally {
Intent intentLaunchMenu = new Intent(SplashActivity.this, MenuActivity.class);
startActivity(intentLaunchMenu);
finish();
}
}
};
splashThread.start();
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
_active = false;
}
return true;
}
}
Code:
package android.bankclosures;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
public class MenuActivity extends Activity implements OnClickListener{
WebView mWebView;
WebView mWebView1;
WebView mWebView2;
WebView mWebView3;
Button Button01;
Button Button02;
Button Button03;
Button Button04;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
Button01=(Button)findViewById(R.id.Button01);
Button02=(Button)findViewById(R.id.Button02);
Button03=(Button)findViewById(R.id.Button03);
Button04=(Button)findViewById(R.id.Button04);
Button01.setOnClickListener(this);
Button02.setOnClickListener(this);
Button03.setOnClickListener(this);
Button04.setOnClickListener(this);
}
public void onClick(View v) {
Intent intentLaunchActivity;
if(v == Button01)
{
intentLaunchActivity = new Intent(MenuActivity.this, Clsdbanks.class);
startActivity(intentLaunchActivity);
}
else if(v == Button02)
{
intentLaunchActivity = new Intent(MenuActivity.this, Press.class);
startActivity(intentLaunchActivity);
}
else if(v == Button03)
{
intentLaunchActivity = new Intent(MenuActivity.this, Form.class);
startActivity(intentLaunchActivity);
}
else if(v == Button04)
{
intentLaunchActivity = new Intent(MenuActivity.this, News.class);
startActivity(intentLaunchActivity);
finish();
}
}
}
Manifest
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.bankclosures"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET" />
<application android:label="@string/app_name" android:enabled="true" android:icon="@drawable/logonobg" android:debuggable="false">
<activity android:name=".SplashActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity><activity android:name=".MenuActivity" android:label="Menu">
</activity>
<activity android:label="Closed Banks" android:name=".Clsdbanks"></activity>
<activity android:label="Press" android:name=".Press"></activity>
<activity android:name=".Form" android:label="Help Form"></activity>
<activity android:name=".News" android:label="RK News"></activity>
</application>
<uses-sdk android:minSdkVersion="4" />
</manifest>