Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Okay, upon your request since this is a basic application, I am posting the complete code.</p> <p><strong>ProjectActivity.java</strong></p> <pre><code>package justinehume.Project; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class ProjectActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button tut1 = (Button) findViewById(R.id.tutorial1); tut1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Jean-Philippe Roy's correction startActivity(new Intent(ProjectActivity.this, Tutorialone.class)); } }); } } </code></pre> <p><strong>Tutorialone.java</strong></p> <pre><code>package justinehume.Project; import android.app.Activity; import android.os.Bundle; public class Tutorialone extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.tutorial1); } } </code></pre> <p><strong>AndroidManifest.xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="justinehume.Project" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" /&gt; &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" &gt; &lt;activity android:name=".ProjectActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:label="@string/app_name" android:name=".Tutorialone"/&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p><em>Note: I have tested this on an emulator and it doesn't crash. I would recommend that you read/view more tutorials to have a better understanding. Good Luck!</em></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload