我是指http://developer.android.com/reference/android/app/Activity.html.
我有一个可以被用户"中断"的活动,例如用户打开菜单来调用首选项屏幕.调用首选项屏幕时onSaveInstanceState(Bundle),我可以保存我的数据.到目前为止这很好.但是,在按下后退按钮onRestoreInstanceState(Bundle savedInstanceState)时不叫.
那么如何保存我的州?在调用新活动时我是否必须这样做?但是怎么样?
我能想到的唯一方法是通过将状态传递给新活动来保存状态,不使用保存的数据执行任何操作,将其返回到第一个活动并恢复状态onActivitResult.但这意味着我必须来回传递数据才能恢复状态.似乎不是一个很好的解决方案.
我具有服务器的SSL服务器证书,并且具有根CA证书,客户端可以在SSL握手期间验证此服务器证书。由于某种原因,我不确定是否真的检索到了正确的根证书。有什么方法可以查看我是否具有正确的根证书?也许是我提供两个文件的openssl命令,输出告诉我“根CA证书确认SSL证书”。
那可能吗?
谢谢。
probalby一个很简单的问题,但这不是我经常使用的领域......
我有html页面"start.html"有通过post请求调用serverlet的表单.这个servlet(JSP)是action.java,我有:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
//please show a message that I am working
// here is some code which takes some time
response.sendRedirect(http://result.html);
}
Run Code Online (Sandbox Code Playgroud)
所以我做了一些处理,然后我显示了一个页面result.html.这一切都很好,问题是在按下start.html中的发送按钮后,我只看到系统正在处理IE中的这个小旋转轮,然后我得到了结果.大多数人可能会错过这个小指标.我想有一个中间页面或带有进度条,旋转轮甚至只有消息"请耐心等待".尽可能简单.我怎样才能做到这一点?
谢谢!
我的android应用程序中有以下代码:
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="activity" />
<fragment
android:id="@+id/list"
android:name="com.hugo.test.FragmentA"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
fragmenta.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="helloA" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
FragmentA.java:
package com.hugo.test;
//some imports here
public class FragmentA extends Fragment {
/** Called when the activity is first created. */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
//super.onCreate(savedInstanceState);
//setContentView(R.layout.main);
return inflater.inflate(R.layout.fragmenta, container, false);
}
}
Run Code Online (Sandbox Code Playgroud)
FragmentActivity.java: …