Hi William,
While you could open an Activity to get a piece of information, it is really more appropriate to us an AlertDialog for that. Here's an example where we do that to get a line number (to jump to) in the demo-ruboto-irb script in Ruboto IRB:
et = edit_text(:hint => "Line number", :input_type => android.text.InputType::TYPE_CLASS_NUMBER)
goto = proc do
@edit_script.requestFocus
line = et.text.to_s.to_i - 1
max_line = @edit_script.getLineCount
line = max_line if line > max_line
line = 1 if line < 1
@edit_script.setSelection @edit_script.getLayout.getLineStart(line)
end
dialog = AlertDialog::Builder.new(@ruboto_java_instance).setTitle("Go to").setView(et).setPositiveButton("Go", goto).create
dialog.window.soft_input_mode = android.view.WindowManager::LayoutParams::SOFT_INPUT_STATE_ALWAYS_VISIBLE
dialog.show
The et (EditText) is the view for getting the information. You'll need to require 'ruboto/widget' and ruboto_import_widgets :EditText.
The goto proc will be called when the user presses the "Go" button.
--
You received this message because you are subscribed to the Google Groups "Ruboto (JRuby on Android)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruboto+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
No, the dialog should not be inside the Activity's content.
search = EditText.new(@ruboto_java_instance)
...inside of MyActivity's onCreate method ?
Since it seems to be available inside of onCreate method,
I also tried - from there - to copy @ruboto_java_instance into a
$global_var.
... Here's a shot at what you're trying to do: