应用程序未出现在应用程序列表中?

时间:2013-07-26 21:56:40

标签: android eclipse manifest

我正在Eclipse中构建一个Android应用程序,但当时我尝试在模拟器上运行它并没有运行,当我在手机中尝试它时,它说它已安装但没有出现在应用程序列表中。求救!

以下是代码:

package com.xanmaya.kapschfinal;

import android.net.Uri;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;

public class MainActivity extends Activity {

@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);


Button btnEnviar = (Button) findViewById(R.id.btnEnviar);
btnEnviar.setOnClickListener(new View.OnClickListener() { 
@Override
public void onClick(View v) {
    }}
);
return true;

}
EditText etModulo = (EditText) findViewById(R.id.etModulo);
EditText etAmpli = (EditText) findViewById(R.id.etAmpli);
EditText etAntena = (EditText) findViewById(R.id.etAntena);
EditText etCable = (EditText) findViewById(R.id.etCable);
EditText etFecha = (EditText) findViewById(R.id.etFecha);
EditText etlugar = (EditText) findViewById(R.id.etlugar);
EditText etenvia = (EditText) findViewById(R.id.etenvia);
CheckBox checkampli = (CheckBox) findViewById(R.id.checkampli);
CheckBox checkantena = (CheckBox) findViewById(R.id.checkantena);
CheckBox checkmodulo = (CheckBox) findViewById(R.id.checkmodulo);
CheckBox checkcable = (CheckBox) findViewById(R.id.checkcable);

{
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.putExtra(Intent.EXTRA_EMAIL, "villasantdesign@gmail.com");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Resumen");
emailIntent.putExtra(Intent.EXTRA_TEXT, etModulo.getText()); etAntena.getText(); etCable.getText(); etlugar.getText(); etFecha.getText(); etAmpli.getText();}{;
Intent emailIntent = new Intent(Intent.ACTION_SENDTO);
emailIntent.setType("message/rfc822");
startActivity(Intent.createChooser(emailIntent, "btnEnviar"));}}

继承人Manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xanmaya.kapschfinal"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk 
    android:minSdkVersion="9" 
    android:targetSdkVersion="18"
        android:maxSdkVersion="18"/>
<compatible-screens></compatible-screens>
<uses-configuration /> 
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<supports-screens android:resizeable="true"
android:largeScreens = "true"
android:normalScreens = "true"
android:smallScreens = "true"
android:anyDensity = "true"/>

<instrumentation android:targetPackage="com.xanmaya.kapschfinal"
android:functionalTest="false"
             android:handleProfiling="false"
             android:icon="@drawable/ic_launcher"
             android:label="@drawable/ic_launcher"
             android:name="string"
android:logo="@drawable/ic_launcher"></instrumentation>



<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.xanmaya.kapschfinal.MainActivity"
        android:label="Kapsch" 
        android:screenOrientation = "portrait"/>

        <intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="android.intent.action.SENDTO"/>
<data android:scheme="mailto"/>
<category android:name="android.intent.category.LAUNCHER" />

</intent-filter>
</application>
<element>


    </element>
</manifest>

2 个答案:

答案 0 :(得分:2)

您需要更改活动的清单条目,并将意图过滤器拆分为两个。

<activity
    android:name="com.xanmaya.kapschfinal.MainActivity"
    android:label="Kapsch" 
    android:screenOrientation="portrait"/>

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    <intent-filter>
        <action android:name="android.intent.action.SENDTO"/>
        <data android:scheme="mailto"/>
    </intent-filter>
</application>

答案 1 :(得分:0)

尝试按照Android原型在onCreate方法中找到所有按钮。

Butoon b;
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    b=findviewbyid(R.id.etAntena);
}