我正在尝试拍照并将其保存到文件中.问题出现了我试图将位图保存到文件.这是我的代码:
private void takePic() {
Intent cameraIntent = new Intent(
android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, 2);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 2) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
ImageView test = (ImageView) findViewById(R.id.test);
test.setImageBitmap(photo);
try {
FileOutputStream out = new FileOutputStream("filename");
photo.compress(Bitmap.CompressFormat.JPEG, 90, out);
} catch (Exception e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
和logcat中的例外:
04-02 14:46:51.975: W/IInputConnectionWrapper(2225): showStatusIcon on inactive InputConnection
04-02 14:46:56.135: W/System.err(2225): java.io.FileNotFoundException: /filename (Read-only file system)
04-02 …Run Code Online (Sandbox Code Playgroud) 我刚刚将我的android adt更新到版本17,现在我无法启动我的android项目.当我尝试更新它时给了我一个错误:
此Android SDK需要Android Developer Toolkit 17.0.0或更高版本.当前版本是16.0.1.v201112150204-238534.请将ADT更新到最新版本.
我试图再次更新,但它告诉我这个
Cannot complete the request. See the error log for details.
Android DDMS will be ignored because it is already installed, and updates are not permitted.
Android Development Tools will be ignored because it is already installed, and updates are not permitted.
Android Hierarchy Viewer will be ignored because it is already installed, and updates are not permitted.
Android Traceview will be ignored because it is already installed, and updates are not permitted. …Run Code Online (Sandbox Code Playgroud) 我试图更新我的表中的行,但更新功能似乎没有响应.我的功能一切正常,还是我错了?
public int editChild(int id, String name, String dob,
int gender, double weight, double lenght, int color, int status) {
ContentValues args = new ContentValues();
args.put("name", name);
args.put("dob", dob);
args.put("weight", weight);
args.put("lenght", lenght);
args.put("color", color);
args.put("status", status);
return database.update(TABLE_CHILDREN, args, "id" + "='" + id
+ "'", null);
}
Run Code Online (Sandbox Code Playgroud)
现在我看到了logcat,抛出了这些异常:
04-03 22:38:32.984: I/dalvikvm(8803): Uncaught exception thrown by finalizer (will be discarded):
04-03 22:38:32.984: I/dalvikvm(8803): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@44c70c20 on children that has not been deactivated or closed
04-03 22:38:32.984: I/dalvikvm(8803): …Run Code Online (Sandbox Code Playgroud) 当我重新调整大小时,我的媒体查询在PC的浏览器中工作正常,但是当我通过localhost使用我的Android设备访问我的网站时,我的媒体查询不起作用?问题是什么?我的设备具有480 x 800像素的分辨率.
这是我的媒体查询:
@media (max-width: 480px) {
#main{width:90%;position:relative;}
div.itemRelated ul li {float: left;width: 20%;}
div.itemRelated ul li a img{width:90%;}
div.itemRelated ul li a{text-align:center;}
.maincontent{width:90%;font-size:.7em;}
#base{width:100%;}
h2, h2 a:link, h2 a:visited{font-size:.7em;}
#container_header{width:96%;}
#container_slideshow{display:none;}
#container_main{width:90%;margin: 0 auto;}
.wrapper960{margin:0 auto;}/*ova treba da se cepne*/
#sidecol_b, #sidecol_a{display:none;}
#content_remainder{width:96%;clear:both;top:0;}
#container_bottom_modules{display:none;}
#container_spacer3{display:none;}
#jazik{float:left;}
.sigProContainer sigProClassic sigProClassic{margin-left:10%;}
#hornav{padding-left:5px;}
#hornav ul li a{font-size:1em;padding: 0 5px;width:8%}
#container_header{width:100%;}
#socialmedia{display:none;}
#search {clear:both;top: 20%;left: 15%;}
.content{width:66%;}
}
Run Code Online (Sandbox Code Playgroud) 我无法从android的共享偏好中检索用户名和密码.我使用此代码保存用户名并传递
SharedPreferences prefs=getSharedPreferences("File", 0);
SharedPreferences.Editor e= prefs.edit();
e.putString("Email", "example@example.com").putString("Password", "password1");
e.commit();
e.putString("Email", "example_2@example.com").putString("Password", "password2");
e.commit();
String s=prefs.getString("Email","not found");
Run Code Online (Sandbox Code Playgroud)
但我不知道如何检索用户登录的信息.任何人都可以帮我解决
我正在尝试制作一个示例地图应用,但地图不会出现在屏幕上,如下所示:

我正在关注这个例子,但我不明白有什么问题,所以我的地图看起来像这样?
我已经添加了这样的API密钥:
keytool -list -alias androiddebugkey -keystore debug.keystore \
-storepass android -keypass android
Run Code Online (Sandbox Code Playgroud)
添加了所有GPS和Internet权限,并且设备已连接到互联网.
我有以下代码,我无法找到为什么不回显$ rslt [0] ["product_id"]; ?cookie在浏览器中,任何人都可以告诉我有什么问题吗?
if (isset($_COOKIE["jshopping_temp_cart"])) {
mysql_connect("localhost", "user", "pass") or die(mysql_error());
mysql_select_db("shopping_katalog") or die(mysql_error());
$result = mysql_query("SELECT * FROM x9qg6_jshopping_cart_temp WHERE id_cookie ='".$_COOKIE["jshopping_temp_cart"]."'");
while ($row = mysql_fetch_array($result)) {
$data = $row['cart'];
$rslt = unserialize($data);
echo $rslt[0]["product_id"];
}
}
Run Code Online (Sandbox Code Playgroud)