My problem is when I open new activity when pressing button an error accoutred "Unfortunately, ISPcheck has stopped".
Here is my MainActivity.java button click event code:

public void btnLogin_OnClick(View view) {
        startActivity(new Intent(MainActivity.this, PersonInfo.class));
    }

Here is button xml code in activity_main.xml:

<Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="تسجيل الدخول"
            android:id="@+id/btnLogin"
            android:layout_marginTop="72dp"
            android:textColor="#ffffff"
            android:layout_below="@+id/txtPassword"
            android:layout_centerHorizontal="true"
            android: önClick="btnLogin_OnClick" /
>

Here is AndroidManifest.xml code:

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.hsa.ispcheck.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>
        <activity
            android:name="com.hsa.ispcheck.PersonInfo"
            android:label="@string/title_activity_person_info" >
        </activity>
    </application>

</manifest>

So, What's wrong with what I did?

Note: I'm using Android Studio v0.3.2

Recommended Answers

All 4 Replies

1) You need to post full stacktrace of the error not single line you provided above
2) new Intent need start with context getContext()

In Android Studio, you will have a Logcat view which will give you a stack trace of the exception. We'll need that to figure out where what goes wrong.

I think we can not help you because the code is not clear, as Peter mentioned above You need to post full stacktrace of the error not single line

I think error in your code please check and update it definately works properly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.