startactivityforresult from dialogpreference (non activity)

后端 未结 1 462
旧时难觅i
旧时难觅i 2021-01-26 14:04

I have a dialog preference with a button on it that I want to have open another activity. When that activity is complete, I want the dialog to update a textview (in the dialog)

1条回答
  •  无人及你
    2021-01-26 14:52

    Have you tried using:

    runOnUiThread(new Runnable() { 
        public void run() 
        { 
            Intent i = new Intent("com.shared.FileChooser");
            i.putExtra("com.shared.FileChooser.EXTRA_PATH", vsbPath);
            i.putExtra("com.shared.FileChooser.EXTRA_EXTENSIONS", vsbExtensions);
    
            startActivityForResult(i,0);
        } 
     }); 
    

    inside your Dialog's onClick event? That should cause it to run on the UI thread of the Activity.

    0 讨论(0)
提交回复
热议问题