0

出于某种奇怪的原因,我得到

android.content.ActivityNotFoundException: No Activity found to handle Intent {  
    act=android.intent.action.VIEW dat=geo:0,0?q=Fitness24Seven, Malmö }

在我更新 Eclipse 之前,这个应用程序运行良好。我尝试搜索类似的问题,但没有运气。这可能与清单意图过滤器有关,但我不明白该怎么做(如果这就是问题所在)。

这是我的代码:

package se.projektledningett.studentimalmo;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.NavUtils;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;

public class Fitness24SevenScreen extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_fitness24_seven_screen);
    // Show the Up button in the action bar.
    //setupActionBar();
}

/**
 * Set up the {@link android.app.ActionBar}, if the API is available.
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setupActionBar() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        getActionBar().setDisplayHomeAsUpEnabled(true);
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.fitness24_seven_screen, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case android.R.id.home:
        // This ID represents the Home or Up button. In the case of this
        // activity, the Up button is shown. Use NavUtils to allow users
        // to navigate up one level in the application structure. For
        // more details, see the Navigation pattern on Android Design:
        //

        NavUtils.navigateUpFromSameTask(this);
        return true;
    }
    return super.onOptionsItemSelected(item);
}

public void openFitness24SevenWebpage(View view){
    Uri uriUrl = Uri.parse("http://www.fitness24seven.com");
    Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
    startActivity(launchBrowser);
}

public void openFitness24SevenMap(View view){
    Uri uri = Uri.parse("geo:0,0?q=Fitness24Seven, Malmö");

    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    startActivity(intent);
}
}

下面是清单:

<activity
        android:name="se.projektledningett.studentimalmo.Fitness24SevenScreen"
        android:label="@string/title_activity_fitness24_seven_screen"
        android:parentActivityName="se.projektledningett.studentimalmo.FitnessTrainingScreen2" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="se.projektledningett.studentimalmo.FitnessTrainingScreen2" />
    </activity>

我不明白为什么在更新后会发生这种情况。我对 Eclipse、代码和环境随机出现的所有奇怪错误感到非常沮丧。一旦我的这个愚蠢的项目完成,我真的不想再看到任何安卓了。如果不解决这个问题,它将惨遭失败。为什么在更新之前它可以完美运行?

4

0 回答 0