public class MainActivity extends Activity { private ImageView iv_location_map; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); iv_location_map = (ImageView) findViewById(R.id.iv_location_map); iv_location_map.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, LocationMainActivity.this); startActivity(intent); } }); } } —————————————————————— Intent intent = new Intent(MainActivity.this, LocationMainActivity.this);这句 |
|
10分 |
LocationMainActivity.this
改成 LocationMainActivity.class |
5分 |
楼上正解!
|
5分 |
1楼正解~
|
5分 |
把需要跳转到的Activity换成.class。 this表示对当前类的引用
|
5分 |
public class MainActivity extends Activity { private ImageView iv_location_map; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); iv_location_map = (ImageView) findViewById(R.id.iv_location_map); iv_location_map.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, LocationMainActivity.class); startActivity(intent); } }); } } |
5分 |
Intent intent = new Intent(MainActivity.this, LocationMainActivity.this);
=> Intent intent = new Intent(MainActivity.this, LocationMainActivity.class); |
5分 |
1,换成class 2 ,看看mainfest中 有没有这个activity
|
问题已解决,谢谢各位回复的大神
|