我一直在Android上使用SQLite,我想在表中的列中添加一个arraylist,然后将数据作为arraylist获取.arraylist是Longs的列表.我注意到SQL有一个存储BLOBS的选项,但是看起来我需要先将arraylist转换为byte [],然后才能将它作为blob存储在我的SQLite数据库中.
如果有人有一个如何将arraylists保存到SQLite数据库的解决方案,将非常感激.或者是否有任何其他选项来保存我的数据数组,我应该考虑?
我目前正在尝试通过http Get调用服务器进行身份验证.下面提供的代码在java项目中编译时有效.将正确的令牌返回给程序.但是,每当我尝试在Android中实现相同的代码时,我都不会通过Get调用返回令牌.
在Android中,我在函数中返回inputLine,但inputLine始终是空字符串.
system.out.println()打印返回的标记.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
public class JavaHttpsExample
{
public static void main(String[] args)
{ String inputLine = new String();
try
{
String httpsURL = "https://the url";
URL myurl = new URL(httpsURL);
HttpsURLConnection con = (HttpsURLConnection)myurl.openConnection();
InputStream ins = con.getInputStream();
InputStreamReader isr=new InputStreamReader(ins);
BufferedReader in =new BufferedReader(isr);
inputLine = in.readLine();
System.out.println(inputLine);
in.close();
}
catch(IOException e)
{
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助!!!