Android application displays black screen after running
- by frgnvola
When I click "Run as an Android Application" on Eclipse, the following is displayed in the console
[2014-06-05 20:07:18 - StudentConnect] Android Launch!
[2014-06-05 20:07:18 - StudentConnect] adb is running normally.
[2014-06-05 20:07:18 - StudentConnect] Performing sandhu.student.connect.SplashActivity activity launch
[2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0
[2014-06-05 20:07:18 - StudentConnect] Refreshing resource folders.
[2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0
[2014-06-05 20:07:18 - StudentConnect] Starting incremental Pre Compiler: Checking resource changes.
[2014-06-05 20:07:18 - StudentConnect] Nothing to pre compile!
[2014-06-05 20:07:18 - StudentConnect] Starting incremental Package build: Checking resource changes.
[2014-06-05 20:07:18 - StudentConnect] Using default Build Tools revision 19.0.0
[2014-06-05 20:07:18 - StudentConnect] Skipping over Post Compiler.
[2014-06-05 20:07:20 - StudentConnect] Application already deployed. No need to reinstall.
[2014-06-05 20:07:20 - StudentConnect] Starting activity sandhu.student.connect.SplashActivity on device 0f0898b2
[2014-06-05 20:07:21 - StudentConnect] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=sandhu.student.connect/.SplashActivity }
[2014-06-05 20:07:21 - StudentConnect] ActivityManager: Warning: Activity not started, its current task has been brought to the front
After deployed to my phone, it only displays a black screen. I recently implemented a splash screen, but it was working fine before; however I think it might have something to do with the problem. Here are my java and xml files:
MainActivity.java
package sandhu.student.connect;
import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class MainActivity extends Activity {
public WebView student_zangle;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView student_zangle = (WebView) findViewById(R.id.student_zangle);
student_zangle.loadUrl("https://zangleweb01.clovisusd.k12.ca.us/studentconnect/");
student_zangle.setWebViewClient(new WebViewClient());
student_zangle.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
WebSettings settings = student_zangle.getSettings();
settings.setJavaScriptEnabled(true);
settings.setBuiltInZoomControls(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
WebView student_zangle = (WebView) findViewById(R.id.student_zangle);
if ((keyCode == KeyEvent.KEYCODE_BACK) && student_zangle.canGoBack()) {
student_zangle.goBack();
return true;
}
else
{
finish();
}
return super.onKeyDown(keyCode, event);
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/blue"
tools:context=".MainActivity" >
<WebView
android:id="@+id/student_zangle"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
SplashActivity.java
package sandhu.student.connect;
import android.os.Bundle;
import android.preference.PreferenceActivity;
public class SplashActivity extends PreferenceActivity {
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.prefs);
}
}
splash_activity.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/blue"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="250dp"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="145dp"
android:contentDescription="@string/zangle_logo"
android:src="@drawable/logo" />
</RelativeLayout>
Also, here is a full copy of the logcat error output:
06-05 20:19:46.698: E/Watchdog(817): !@Sync 1952
06-05 20:20:09.971: E/memtrack(16438): Couldn't load memtrack module (No such file or directory)
06-05 20:20:09.971: E/android.os.Debug(16438): failed to load memtrack module: -2
06-05 20:20:11.012: E/memtrack(16451): Couldn't load memtrack module (No such file or directory)
06-05 20:20:11.012: E/android.os.Debug(16451): failed to load memtrack module: -2
06-05 20:20:11.202: E/EnterpriseContainerManager(817): ContainerPolicy Service is not yet ready!!!
Please help me figure out what is wrong, or at least point me in the right direction. Thanks in advance.