I am working on an android app that has two activities. One is the menu screen and the other is the one that the user actually uses once they have made a selection. The second activity does all of its processing in a worker thread. When I make the selection to move on to the second activity, it “flashes” the activity for about 100ms. I found some logs that look like they would tell me what I need to fix if I knew what they meant.
02-29 10:52:33.850: I/ActivityManager(1255): Starting activity: Intent { cmp=com.wcf.imageShare/.ImageShareActivity }
02-29 10:52:33.920: W/InputManagerService(1255): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@45c0a198 (uid=10097 pid=24918)
02-29 10:52:33.936: W/WindowManager(1255): No window to dispatch pointer action
02-29 10:52:33.952: I/ActivityManager(1255): Displayed activity com.wcf.imageShare/.ImageShareActivity: 96 ms (total 96 ms)
02-29 10:52:34.000: W/WindowManager(1255): No window to dispatch pointer action 1
The program itself is not crashing, it just takes me back to the menuview and displays my choices again. Here is the code I am using to switch activities
lstServers.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
Beacon.activeServer = position;
Intent uploadIntent = new Intent(inst,ImageShareActivity.class);
inst.startActivity(uploadIntent);
}
});
inst holds the ‘this’ variable of the activity that the code is running in since I couldn’t reference it by using ‘this’
Here is the onCreate of the activity I am trying to switch to:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
try
{
progBar = (ProgressBar)findViewById(R.id.progressbar_Horizontal);
tv = (TextView)findViewById(R.id.prog_txt);
btnCancel = (Button)findViewById(R.id.cancel);
btnCancel.setOnClickListener(new OnClickListener()
{
public void onClick(View arg0)
{
try {
uploaderThread.interrupt();
Uploader.CancelUpload();
} catch (Exception e) {
e.printStackTrace();
}
}
});
uploaderThread.start();
}
catch(Exception e)
{
Log.d("Uploader ERROR",e.getMessage());
}
}
And finally the part of the manifest file that has to do with the two activities.
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:debuggable="true">
<activity
android:name=".ImageShareActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
</activity>
<activity android:name=".ServerChoiceActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<data android:mimeType="image/*"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
</application>
Does anyone have any suggestions or know of something that I am missing?
Thanks
Nick Long
Change this to this :