开发者

Main Activity not shown in Android

I have an application in Android, I've changed the main Activity, and now nothing is showing up when I launch it. I don't know what could be wrong. Please help.

Main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
>
<TextView  
    android:id="@+id/text1" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello"
 />
<Button  
android:id="@+id/btnCrash"
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:text="@string/btnCrash"
/>
</LinearLayout>

Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest package="gdpTesis.client" android:versionCode="1"
android:versionName="1.0" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:icon="@drawable/icon" android:label="@string/app_name"
    android:name="gdpTesis.client.main.GdpTesisApplication">
    <activity android:name=".main.GdpTesisMainActivity"
        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>

The Activity

package gdpTesis.client.main;

import gdpTesis.client.R;
import android.app.Activity;
import android.os.Bundle;

public class GdpTesisMainActivity extends Activity {

    @Override
        public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
    }
}


I do not fully understand your naming conventions. The Activity package and name is

gdpTesis.client.main
GdpTesisMainActivity

The Manifest package and name is

gdpTesis.client
.main.GdpTesisMainActivity

I do not understand the need for

import gdtTesis.client.R

Consider:

Activity

package gdpTesis.client
class GdpTesis

Manifest

package gdpTesis.client
Activity name GdpTesis

and delete the Manifest Application name and import gdpTesis.client.R


I CAN'T BELIEVE IT! I'm with the emulator, and I don't have an Android phone, so I expected after running the application, see it in the emulator screen, but it was locked, and it doesn't unlock by itself, so just unlocking it with the mouse...showed the activity. sorry! and thanks!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜