我有两个从android调用的javascript函数.经过长时间的调试会议后,我意识到问题是由第二个函数在第一个函数完成之前被调用的事实引起的.我已经使用延迟等搜索了这些示例,但它们都依赖于另一个中的函数调用.
function FunctInit(someVarible){ //someVariable is sent from android, cannot call again from getResult
//init and fill screen
}
function getResult(){ //also getResult need to be called from android via button
//return some variables
}
Run Code Online (Sandbox Code Playgroud)
如何强制getResult等待FuncInit?有没有办法通过Javascript实现这一目标?
嗨我有一个包含两个片段的linearLayout,我在这个布局中添加了代码选项卡.我想要的是当我点击tab1时可以从指定的类中填充自己的片段,但是在tab2中我想将这个类更改为另一个类.谢谢
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/frags">
<fragment class="com.tugce.MitsActionBar.DoktorlarFragment"
android:id="@+id/frag_title"
android:visibility="gone"
android:layout_marginTop="?android:attr/actionBarSize"
android:layout_width="@dimen/titles_size"
android:layout_height="match_parent" />
<fragment class="com.tugce.MitsActionBar.ContentFragment"
android:id="@+id/frag_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Run Code Online (Sandbox Code Playgroud)