如何开始从花药活动的新活动......在android系统?花药、系统、android

2023-09-07 12:59:33 作者:>不带符号的长:我们都是毕业后才爱上学校

我要开始从AB的活动,(从LinearLayout中延伸)一个新的活动..但这个code是不正确的。

 意向书I =新意图(SearchResultForm.this,MainActivity.class);startActivity(ⅰ); 

......

 公共类SearchResultForm扩展的LinearLayout {... 

和我得到这个错误。

      

类型SearchResultForm没有外围实例是在范围访问

  

我该怎么办呢?

解决方案

只是猜测,因为我看不到你的code的休息,但尝试:

 意向书I =新意图(这一点,MainActivity.class);startActivity(ⅰ); 
藏红花原来不是花,而是花蕊

i want to start a new activity from ab activity that (extends from Linearlayout) .. but this code is not right

Intent i = new Intent(SearchResultForm.this, MainActivity.class);
startActivity(i);

... ...

public class SearchResultForm extends LinearLayout{ ...

and i get this error ..

No enclosing instance of the type SearchResultForm is accessible in scope

how can i do it ?

解决方案

Just guessing since I can't see the rest of your code, but try:

Intent i = new Intent(this, MainActivity.class);
startActivity(i);