Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid developer first app tutorial
    primarykey
    data
    text
    <p>Thank you for the helpful suggestions, I've edited the initial question since I'd like to show images of what the project looks like and the blank screen I'm getting which is different than what the tutorial indicates should be displaying. I was able to resolve that first problem (it just sort of went away) however, I'm running into a problem after creating the first intent as described in the second portion of the article located here: developer.android.com/training/basics/firstapp/starting-activity.html#receivetheintent</p> <p>The project builds but the Run Configuration I've set up for the project doesn't display any of the input elements as listed in the code below. I'm unsure as how to further troubleshoot the problem and would really appreciate any additional help. Thanks again for the help.</p> <p>Emulator: <a href="http://s1278.beta.photobucket.com/user/cetmrw791346/media/1_zps116f17a9.png.html" rel="nofollow">http://s1278.beta.photobucket.com/user/cetmrw791346/media/1_zps116f17a9.png.html</a></p> <p>Package Explorer: <a href="http://s1278.beta.photobucket.com/user/cetmrw791346/media/2_zps0f2b94a2.png.html" rel="nofollow">http://s1278.beta.photobucket.com/user/cetmrw791346/media/2_zps0f2b94a2.png.html</a></p> <p>And here are the relevant files:</p> <pre><code>**AndroidManifest.xml** &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.firstapp" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;activity android:name="com.example.firstapp.MainActivity" 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:name="com.example.firstapp.DisplayMessageActivity" android:label="@string/title_activity_display_message" android:parentActivityName="com.example.firstapp.MainActivity" &gt; &lt;meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.firstapp.MainActivity" /&gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; **MainActivity.java** package com.example.firstapp; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.View; import android.widget.EditText; public class MainActivity extends Activity { public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } /** Called when the user clicks the Send button */ public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } } activity_main.xml &lt;LinearLayout 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:orientation="horizontal" tools:context=".MainActivity" &gt; &lt;EditText android:id="@+id/edit_message" android:layout_weight="1" android:layout_width="0dp" android:layout_height="wrap_content" android:hint="@string/edit_message" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" android:onClick="sendMessage" /&gt; &lt;/LinearLayout&gt; **strings.xml** &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;resources&gt; &lt;string name="app_name"&gt;My First App&lt;/string&gt; &lt;string name="edit_message"&gt;Enter a message&lt;/string&gt; &lt;string name="button_send"&gt;Send&lt;/string&gt; &lt;string name="menu_settings"&gt;Settings&lt;/string&gt; &lt;string name="title_activity_main"&gt;MainActivity&lt;/string&gt; &lt;string name="title_activity_display_message"&gt;DisplayMessageActivity&lt;/string&gt; &lt;string name="action_settings"&gt;Settings&lt;/string&gt; &lt;string name="hello_world"&gt;Hello world!&lt;/string&gt; &lt;/resources&gt; activity_display_message.xml &lt;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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".DisplayMessageActivity" &gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /&gt; &lt;/RelativeLayout&gt; **DisplayMessageActivity.java** package com.example.firstapp; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.MenuItem; import android.support.v4.app.NavUtils; import android.annotation.TargetApi; import android.os.Build; public class DisplayMessageActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_message); // Show the Up button in the action bar. setupActionBar(); } /** * Set up the {@link android.app.ActionBar}, if the API is available. */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) private void setupActionBar() { if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) { getActionBar().setDisplayHomeAsUpEnabled(true); } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // This ID represents the Home or Up button. In the case of this // activity, the Up button is shown. Use NavUtils to allow users // to navigate up one level in the application structure. For // more details, see the Navigation pattern on Android Design: // // http://developer.android.com/design/patterns/navigation.html#up-vs-back // NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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