Java 我们可以知道启动当前活动的活动的类名吗?

Java 我们可以知道启动当前活动的活动的类名吗?,java,android,android-activity,Java,Android,Android Activity,除了在Intent中作为Extra传递类名之外,是否有其他方法可以知道哪个活动类启动了另一个活动类? 当我们创建新的意图(this,SomeOtherActivity.class)时,当我们在创建SomeOtherActivity时,是否可以在中获取this的名称 Intent i = new Intent(this, SomeOtherActivity.class) i.putExtra("ACTIVITY_NAME", this.getClass().getName()); 使用以下命令检

除了在
Intent
中作为
Extra
传递类名之外,是否有其他方法可以知道哪个活动类启动了另一个活动类?

当我们创建新的意图(this,SomeOtherActivity.class)时,当我们在创建
SomeOtherActivity
时,是否可以在中获取
this
的名称

Intent i = new Intent(this, SomeOtherActivity.class)
i.putExtra("ACTIVITY_NAME", this.getClass().getName());
使用以下命令检索它:

Bundle extras = getIntent().getExtras();
String activityName = extras.getString("STRING_I_NEED");

那么框架不提供这些信息?我必须明确地通过它?好的,你应该通过,因为意图不是。也找不到任何东西。但不是100%确定。。。如果还有其他答案,我们就等着吧。您是否调试过@
onCreate
搜索上下文?似乎您是-close的复制品