由于一些奇怪的原因,我得到了
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,代码和环境随机出现的所有奇怪错误感到非常沮丧。一旦我的这个愚蠢的项目完成,我真的不想看到更多的机器人。如果这没有解决,它将失败。为什么它在更新之前完美运行?