Miguel Miguel - 2 months ago 8
Android Question

Application does not appear on app list?

Im building an application for Android in Eclipse, but at the time I try to run it on the emulator it doesnt run and when I try it in the phone it says its installed but doesnt appear in the application list. Help please!

Here is the code:

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"));}}


And heres the 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>

Answer

You need to change your manifest entry for the activity and split the intent filter into two.

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