I have two apps that both extend activities and work perfect on their own, but when I call intent of one to view data in the other the app crashes. I have taken the second and made it a separate java file in my app. Also, I have updated the manifest to include this new activity. Where do I call the intent? If all I want from the second activity is for it to get data and return data should I use startactivityforresult instead? The main thing I want to do is get sensor data from the orientation sensor and show it on my display while still running the original activity. This is how I call the second activity:
Intent intent = new Intent(this, LeanAngle.class);{
startActivity(intent);
Maybe the problem is where I am calling it. Is there a specific place to call it? Also,开发者_Python百科 it has the same view as the main activity does, r.layout.main.
You are calling it correctly. I assume your placement is wrong. It will only work if it is the last thing you call in onCreate(). If that is indeed where it is located.
精彩评论