如何开始从花药活动的新活动......在android系统? [英] how to start a new activity from anther activity ... in android?

查看:131
本文介绍了如何开始从花药活动的新活动......在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要开始从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);

这篇关于如何开始从花药活动的新活动......在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆