Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9275601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:37:39+00:00 2026-06-18T16:37:39+00:00

Whenever i start my application, it keep crashing. As i had some similiar problems

  • 0

Whenever i start my application, it keep crashing.
As i had some similiar problems in the past with the RelativeLayout, i’d guess the problem is related to this.
I created the layout with the Graphical Interface.

Neither the java application, nor the layout returns any errors or important warnings.

MainActivity.java

package com.XXX.mcgneussapp2;


import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.CookieManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final ProgressBar Pbar = (ProgressBar) findViewById(R.id.pB1);
        final TextView loadtext = (TextView) findViewById(R.id.textView1);  
        final ImageView imgFavorite = (ImageView) findViewById(R.id.imageView2);
        final ImageView imgFavorite2 = (ImageView) findViewById(R.id.imageView3);
        final ImageView imgFavorite3 = (ImageView) findViewById(R.id.imageView4);

        WebView engine = (WebView) findViewById(R.id.web_engine);  
        engine.setWebViewClient(new WebViewClient() 
        {  
            @Override  
            public boolean shouldOverrideUrlLoading(WebView view, String url)  
            {  
              return false;  
            }  

            public void onPageStarted(WebView view, String url, Bitmap favicon)
            {
                view.setVisibility(View.GONE);
                Pbar.setVisibility(ProgressBar.VISIBLE);
                loadtext.setVisibility(View.VISIBLE);
            }

            public void onPageFinished (WebView view, String url)
            {
                view.setVisibility(View.VISIBLE);
                Pbar.setVisibility(ProgressBar.GONE);
                loadtext.setVisibility(View.GONE);
            }
        });          


        imgFavorite.setClickable(true);
        imgFavorite.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v)  //favoriten
            {
                WebView engine = (WebView) findViewById(R.id.web_engine);  
                engine.loadUrl("https://www.free-way.me/mcgapp/recommend.php");
                imgFavorite3.setVisibility(View.VISIBLE);
                imgFavorite2.setVisibility(View.VISIBLE);
            }
        });


        imgFavorite2.setClickable(true);
        imgFavorite2.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v)  //weiter
            {
                WebView engine = (WebView) findViewById(R.id.web_engine);  
                engine.loadUrl("https://www.free-way.me/mcgapp/index.php?siteid=1&nohead");
                imgFavorite3.setVisibility(View.VISIBLE);
                imgFavorite2.setVisibility(View.GONE);
            }
        });


        imgFavorite3.setClickable(true);
        imgFavorite3.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) //zurück
            {
                WebView engine = (WebView) findViewById(R.id.web_engine);  
                engine.loadUrl("https://www.free-way.me/mcgapp/index.php?nohead");
                imgFavorite3.setVisibility(View.GONE);
                imgFavorite2.setVisibility(View.VISIBLE);
            }
        });

        engine.getSettings().setJavaScriptEnabled(true);
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.setAcceptCookie(true);
        engine.loadUrl("https://www.free-way.me/mcgapp/index.php?nohead");  
        imgFavorite3.setVisibility(View.GONE);

    }
}

activity_main.xml

<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"
        tools:context=".MainActivity" >

        <ImageView
            android:id="@+id/imageView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:src="@android:drawable/bottom_bar" />

        <ImageView
            android:id="@+id/imageView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignTop="@+id/imageView5"
            android:layout_centerHorizontal="true"
            android:clickable="true"
            android:src="@android:drawable/ic_menu_myplaces" />

        <ImageView
            android:id="@+id/imageView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignTop="@+id/imageView5"
            android:layout_marginLeft="14dp"
            android:clickable="true"
            android:src="@android:drawable/ic_media_previous" />

        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/imageView5"
            android:layout_marginRight="14dp"
            android:clickable="true"
            android:src="@android:drawable/ic_media_next" />

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@+id/pB1"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="24dp"
            android:text="Bitte warten"
            android:textAppearance="?android:attr/textAppearanceMedium"
            tools:ignore="HardcodedText" />

        <ProgressBar
            android:id="@+id/pB1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true" />

        <WebView
            android:id="@+id/web_engine"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_above="@+id/imageView5"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true" />

    </RelativeLayout>

LogCat Dump

 > 02-12 11:45:32.795: D/AndroidRuntime(309): Shutting down VM 02-12
    > 11:45:32.795: W/dalvikvm(309): threadid=1: thread exiting with
    > uncaught exception (group=0x4001d800) 02-12 11:45:32.805:
    > E/AndroidRuntime(309): FATAL EXCEPTION: main 02-12 11:45:32.805:
    > E/AndroidRuntime(309): java.lang.RuntimeException: Unable to start
    > activity
    > ComponentInfo{com.XXX.mcgneussapp2/com.XXX.mcgneussapp2.MainActivity}:
    > java.lang.ClassCastException: android.widget.ImageView 02-12
    > 11:45:32.805: E/AndroidRuntime(309):  at
    > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
    > 02-12 11:45:32.805: E/AndroidRuntime(309):    at
    > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    > 02-12 11:45:32.805: E/AndroidRuntime(309):    at
    > android.app.ActivityThread.access$2300(ActivityThread.java:125) 02-12
    > 11:45:32.805: E/AndroidRuntime(309):  at
    > android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    > 02-12 11:45:32.805: E/AndroidRuntime(309):    at
    > android.os.Handler.dispatchMessage(Handler.java:99) 02-12
    > 11:45:32.805: E/AndroidRuntime(309):  at
    > android.os.Looper.loop(Looper.java:123) 02-12 11:45:32.805:
    > E/AndroidRuntime(309):    at
    > android.app.ActivityThread.main(ActivityThread.java:4627) 02-12
    > 11:45:32.805: E/AndroidRuntime(309):  at
    > java.lang.reflect.Method.invokeNative(Native Method) 02-12
    > 11:45:32.805: E/AndroidRuntime(309):  at
    > java.lang.reflect.Method.invoke(Method.java:521) 02-12 11:45:32.805:
    > E/AndroidRuntime(309):    at
    > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    > 02-12 11:45:32.805: E/AndroidRuntime(309):    at
    > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 02-12
    > 11:45:32.805: E/AndroidRuntime(309):  at
    > dalvik.system.NativeStart.main(Native Method) 02-12 11:45:32.805:
    > E/AndroidRuntime(309): Caused by: java.lang.ClassCastException:
    > android.widget.ImageView 02-12 11:45:32.805: E/AndroidRuntime(309):
    >   at
    > com.XXX.mcgneussapp2.MainActivity.onCreate(MainActivity.java:24)
    > 02-12 11:45:32.805: E/AndroidRuntime(309):    at
    > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    > 02-12 11:45:32.805: E/AndroidRuntime(309):    at
    > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
    > 02-12 11:45:32.805: E/AndroidRuntime(309):    ... 11 more 02-12
    > 11:45:35.784: I/Process(309): Sending signal. PID: 309 SIG: 9 02-12
    > 11:46:26.815: D/AndroidRuntime(343): Shutting down VM 02-12
    > 11:46:26.815: W/dalvikvm(343): threadid=1: thread exiting with
    > uncaught exception (group=0x4001d800) 02-12 11:46:26.825:
    > E/AndroidRuntime(343): FATAL EXCEPTION: main 02-12 11:46:26.825:
    > E/AndroidRuntime(343): java.lang.RuntimeException: Unable to start
    > activity
    > ComponentInfo{com.XXX.mcgneussapp2/com.XXX.mcgneussapp2.MainActivity}:
    > java.lang.ClassCastException: android.widget.ImageView 02-12
    > 11:46:26.825: E/AndroidRuntime(343):  at
    > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
    > 02-12 11:46:26.825: E/AndroidRuntime(343):    at
    > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
    > 02-12 11:46:26.825: E/AndroidRuntime(343):    at
    > android.app.ActivityThread.access$2300(ActivityThread.java:125) 02-12
    > 11:46:26.825: E/AndroidRuntime(343):  at
    > android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
    > 02-12 11:46:26.825: E/AndroidRuntime(343):    at
    > android.os.Handler.dispatchMessage(Handler.java:99) 02-12
    > 11:46:26.825: E/AndroidRuntime(343):  at
    > android.os.Looper.loop(Looper.java:123) 02-12 11:46:26.825:
    > E/AndroidRuntime(343):    at
    > android.app.ActivityThread.main(ActivityThread.java:4627) 02-12
    > 11:46:26.825: E/AndroidRuntime(343):  at
    > java.lang.reflect.Method.invokeNative(Native Method) 02-12
    > 11:46:26.825: E/AndroidRuntime(343):  at
    > java.lang.reflect.Method.invoke(Method.java:521) 02-12 11:46:26.825:
    > E/AndroidRuntime(343):    at
    > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    > 02-12 11:46:26.825: E/AndroidRuntime(343):    at
    > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626) 02-12
    > 11:46:26.825: E/AndroidRuntime(343):  at
    > dalvik.system.NativeStart.main(Native Method) 02-12 11:46:26.825:
    > E/AndroidRuntime(343): Caused by: java.lang.ClassCastException:
    > android.widget.ImageView 02-12 11:46:26.825: E/AndroidRuntime(343):
    >   at
    > com.XXX.mcgneussapp2.MainActivity.onCreate(MainActivity.java:24)
    > 02-12 11:46:26.825: E/AndroidRuntime(343):    at
    > android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    > 02-12 11:46:26.825: E/AndroidRuntime(343):    at
    > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
    > 02-12 11:46:26.825: E/AndroidRuntime(343):    ... 11 more

//edit:
AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.XXX.mcgneussapp2"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.XXX.mcgneussapp2.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:37:40+00:00Added an answer on June 18, 2026 at 4:37 pm

    Your code worked fine here. Try cleaning your project and rebuild, as A.A suggested in the comments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am faced with this weird error. Whenever I start my application on my
I have to run some background tasks whenever an application is activated / or
I'm having an issue with Reporting Services. Whenever I start the application, loading of
I used ShellExecuteEx to call iexplore.exe , Whenever I start the application a new
Whenever I start the application it keeps force closing citing the log below. Is
I want to start an application whenever an email arrives in outlook. Is there
I am planning to start my application whenever the user starts the computer. ASFA
Whenever I start my emulator from Eclipse it loads, but I CANNOT open the
Whenever I start a shell in vim using :sh, it doesn't source my ~/.bashrc
The screen which shows whenever i start Netbeans is very annoying, and among the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.