2013-07-26 170 views
1

Im在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, "[email protected]"); 
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

您需要更改活動的清單項和意圖過濾器一分爲二。

<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> 
+0

口口聲聲說「[2013年7月26日17時28分49秒 - KapschFinal]沒有啓動活動發現 ![2013年7月26日17時28分49秒 - KapschFinal]的推出只會同步的設備上的應用程序包!「 – Miguel

+0

謝謝!我解決了這個問題! – Miguel

0

嘗試關注Android原型在onCreate方法中查找所有按鈕。

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