在Google Cloud Messaging中,注册ID的最大长度是多少?
我实际上在WebView中记录了会话.但我也使用httpclient来发送和从网络获取数据.我在互联网上看到,无法获取WebView的内容,因此我需要使用我的httpclient从Web服务获取数据.
问题是这个webservice使用会话...而我的会话在我的WebView中,所以httpclient没有它,我无法访问webservice的内容.
我看到很多关于这个问题的帖子,但我不明白解决方案.
这是我在onPageStarted上做的:
CookieManager mgr = CookieManager.getInstance();
Log.i( "URL", url );
Log.i("Cookie",mgr.getCookie("mywebsite.com"));
String cookie_string = mgr.getCookie("mywebsite.com");
if(cookie_string.length() > 1) {
Data.instance().getPref().edit().putString("cookie",cookie_string).commit();
}
Run Code Online (Sandbox Code Playgroud)
我看到我有这样的东西,所以我希望那些包括会话:(我删除号码)
__utma=......(number)......;
__utmc=number;
__utmz=number.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
wt3_eid=%number%number;
wt3_sid=%number
Run Code Online (Sandbox Code Playgroud)
然后我不知道该怎么做才能在我的httpclient中设置这个cookie.我尝试了,没有成功:
HttpClient client = new DefaultHttpClient();
BasicCookieStore cookieStore = new BasicCookieStore();
String login_cookie_string = Data.instance().getPref().getString("cookie", "");
String[] cookie_parts = null;
if(login_cookie_string.length()> 0)
{
//debug_view.setText(login_cookie_string);
Log.d("COOKIE", login_cookie_string);
cookie_parts = login_cookie_string.split(";");
for(int t=0;t < cookie_parts.length;t++)
{
String[] cookieContent = cookie_parts[t].split("=");
Cookie login_cookie = new BasicClientCookie(cookieContent[0],cookieContent[1]);
((BasicClientCookie) login_cookie).setDomain("mywebsite.com");
cookieStore.addCookie(login_cookie);
}
}
((AbstractHttpClient) client).setCookieStore(cookieStore);
Run Code Online (Sandbox Code Playgroud) 我有一个从数据库中获取产品的任务 ContinueWith action that operate some UI modification, therefore I had a problem because the Task create a new thread, and the UI modification was executed not in the UI Thread.
我尝试使用此修复程序:
var currentScheduler = TaskScheduler.Current;
Task.Factory.StartNew(() =>
{
// get products
}).ContinueWith((x) => handleProductsArrived(x.Result, x.Exception), currentScheduler);
Run Code Online (Sandbox Code Playgroud)
但它根本不起作用.我查了一下ContinueWith没有在currentScheduler的线程中执行,而是在另一个中执行.
我发现了这个方法:
Task.Factory.StartNew(() =>
{
// get products
}).ContinueWith((x) => handleProductsArrived(x.Result, x.Exception), TaskScheduler.FromCurrentSynchronizationContext());
Run Code Online (Sandbox Code Playgroud)
它的工作原理.那有什么不同呢?为什么我的第一个代码不起作用?谢谢!
我想知道在android中是否可以执行这样的表单:

此刻,我做了一个形状来生成边框(我使用这个形状作为我的线性布局的背景,但我不知道如何处理文本).
提前致谢.
我的应用程序上的原始文件夹中有一些声音.有时我需要播放声音,但我不知道究竟是哪个.
示例:
String actualSound ="hit"
playSound(mediaPlayer,R.Raw.actualSound));
我当然想玩R.raw.hit,但我不知道怎么做.
谢谢.
我有一个 ListView,里面有 EditText。实际上,当我触摸 的某个元素时Listview,就会EditText出现焦点和键盘。好的。问题是我想通过 listView 的 onItemClickListener 对此 EditText 执行某些操作,但似乎我的代码从未进入此方法。
我尝试了一些setDescendantFocusability列表视图,但没有解决问题。
多谢。
public class NoteAdapter extends BaseAdapter {
private ArrayList<String> notes;
private LayoutInflater inflater;
private Context context;
public NoteAdapter(Context context, ArrayList<String> notes) {
inflater = LayoutInflater.from(context);
this.notes = notes;
this.context = context;
}
public int getCount() {
// TODO Auto-generated method stub
return notes.size();
}
public Object getItem(int position) {
// TODO Auto-generated method stub
return notes.get(position);
}
public long getItemId(int id) {
// …Run Code Online (Sandbox Code Playgroud) 我必须根据id值删除大量数据.哪一个是最快的:
DELETE FROM myTable WHERE id = '10' OR id = '20' OR id = '43' OR id = '54' .......
Run Code Online (Sandbox Code Playgroud)
要么
DELETE FROM myTable WHERE id = '10'; DELETE FROM myTable WHERE id = '20'; ........
Run Code Online (Sandbox Code Playgroud)
如果您有其他解决方案,请不要犹豫告诉我.
(这里的id不是主键或索引,是一个外键,因为它引用了一个单词,我可以在这个数据库中有一个单词的多个条目)
我使用MySQL,但我希望我的查询可以应用于其他RDBMS
我的应用程序由四个选项卡组成:一个webview,三个带有一些text/edittext的视图,...问题是我的app消耗了大量的CPU,我不明白为什么,其中一个主要问题是当应用程序是onPause(用户使用主页按钮),我的应用程序仍然使用CPU(大约20%,甚至更多!)并且耗费电量.
我不明白用了那么多CPU,所以我有两个问题:
非常感谢 !
编辑:
似乎我的webview消耗了CPU.如何在onPause期间停止此webview而不破坏webview对象?
如何将显示的位置移动到GridView中?
在Windows 8上使用WinRT.
我尝试我的gridview的ScrollIntoView方法,但似乎不起作用.