Go Back   Android Forums > Android Discussion > Android Applications
Android Applications All the information you could ever want about Android Applications. Learn about apps and get help with them... all here! New apps can be found and announced in the Applications Announcements forum linked below.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old January 2nd, 2013, 07:38 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 2
 
Device(s):
Carrier: Not Provided

Thanks: 0
Thanked 0 Times in 0 Posts
Default from one screen to another

Hi
I have made a copy off an App found on the Internet. Android activity – from one screen to another screen
My version doesn't work. When I right click on my projekt, choose Run As, and Android Application, the virtual device starts ok, but nothing happens.
What can be wrong?
Here is my App:
package
com.example.lene;

import
android.app.Activity;

import
android.content.Context;

import
android.content.Intent;

import
android.os.Bundle;

import
android.view.View;

import
android.view.View.OnClickListener;

import
android.widget.Button;

public
class AppActivity extends Activity {

Button
button;

@Override

publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.
main);
addListenerOnButton();
}

publicvoid addListenerOnButton() {

final Context context = this;

button = (Button) findViewById(R.id.button1);

button.setOnClickListener(new OnClickListener() {

@Override

publicvoid onClick(View arg0) {

Intent intent =
new Intent(context, App2Activity.class);
startActivity(intent);

}

});

}

}
package
com.example.lene;

import
android.app.Activity;

import
android.os.Bundle;

import
android.widget.Button;

public
class App2Activity extends Activity {

Button
button;

@Override

publicvoid onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.
main2);
}

}
<?
xmlversion="1.0"encoding="utf-8"?>
<
LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"

android:id="@+id/linearLayout1"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

androidrientation="vertical">


<TextView

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="I&apos;m screen 1 (main.xml)"

android:textAppearance="?android:attr/textAppearanceLarge"/>


<Button

android:id="@+id/button1"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:text="Click me to another screen"/>

</LinearLayout>
<?
xmlversion="1.0"encoding="utf-8"?>
<
LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

androidrientation="vertical">

<TextView

android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="I&apos;m screen 2 (main2.xml)"

android:textAppearance="?android:attr/textAppearanceLarge"/>



</LinearLayout>
<?
xmlversion="1.0"encoding="utf-8"?>
<
manifestxmlns:android="http://schemas.android.com/apk/res/android"

package="com.example.lene"

android:versionCode="1"

android:versionName="1.0">


<uses-sdkandroid:minSdkVersion="10"/>





<application

android:icon="@drawable/ic_launcher"

android:label="@string/app_name">

<activity

android:label="@string/app_name"

android:name=".AppActivity">

<intent-filter>

<actionandroid:name="android.intent.action.MAIN"/>


<categoryandroid:name="android.intent.category.LAUNCHER"/>

</intent-filter>

</activity>

<activity

android:label="@string/app_name"

android:name=".App2Activity">

</activity>


</application>

</manifest>

lenelarsen26 is offline  
Reply With Quote
sponsored links
Reply


Go Back   Android Forums > Android Discussion > Android Applications
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:15 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.