File tree Expand file tree Collapse file tree 3 files changed +7
-6
lines changed
apps/android_pythonnative_3/app/src/main/python/app
libs/pythonnative/pythonnative Expand file tree Collapse file tree 3 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ def on_create(self):
1212 # list_view = pn.ListView(self.native_instance, list_data)
1313 # stack_view.add_view(list_view)
1414 button = pn .Button (self .native_instance , "Button" )
15- button .set_on_click (lambda : print ("Button was clicked!" ))
15+ button .set_on_click (lambda : self .navigate_to ("" ))
16+ # button.set_on_click(lambda: print("Button was clicked!"))
1617 stack_view .add_view (button )
1718 self .set_root_view (stack_view )
1819
Original file line number Diff line number Diff line change @@ -8,9 +8,8 @@ def __init__(self, native_instance):
88 def on_create (self ):
99 super ().on_create ()
1010 stack_view = pn .StackView (self .native_instance )
11- button = pn .Button (self .native_instance , "Button" )
12- button .set_on_click (lambda : print ("Button was clicked!" ))
13- stack_view .add_view (button )
11+ label = pn .Label (self .native_instance , "Second page!" )
12+ stack_view .add_view (label )
1413 self .set_root_view (stack_view )
1514
1615 def on_start (self ):
Original file line number Diff line number Diff line change @@ -133,8 +133,9 @@ def on_restore_instance_state(self) -> None:
133133 print ("Android on_restore_instance_state() called" )
134134
135135 def navigate_to (self , page ) -> None :
136- IntentClass = jclass ("android.content.Intent" )
137- intent = IntentClass (self .native_instance , page .native_class )
136+ # intent = jclass("android.content.Intent")(self.native_instance, page.native_class)
137+ intent = jclass ("android.content.Intent" )(self .native_instance ,
138+ jclass ("com.pythonnative.pythonnative.SecondActivity" ))
138139 self .native_instance .startActivity (intent )
139140
140141else :
You can’t perform that action at this time.
0 commit comments