質問

I am setting up an App Widget, When the user adds the widget to their home screen, It pops up with my configuration activity.

but now I need my user to login, SO i redirect them to my login activty,

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!isLoggedIn()) {
        Intent intent = new Intent(AppWidgetConfigureActivity.this, LoginActivity.class);
        intent.putExtra("Source", "widgetConfig");
        startActivity(intent);
        this.finnish();
    }

But now when my login activity has successfully logged in, I need to create my appwidget config intent and start it up again.

But im not sure how to do this, because the config activity contains information like the widget id etc.

How can I start-up my config activity again?

役に立ちましたか?

解決

The answer may be as simple as not calling finish(). This will keep you configuration activity on the task stack and when the login activity finishes, the configuration activity will be displayed again.

If you used startActivityForResult, you could use your login activity to get some data that can be used when coming back to your own activity.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top