我正在将HTML
保存在assets
文件夹中的本地文档加载到WebView
.它在2.3设备中显示良好,但在ICS +设备中显示空白屏幕.
public void DownloadFromUrl(String imageURL, String fileName) {
//this is the downloader method
try {
URL url = new URL("http://picosong.com/wvaV");
File file = new File(fileName);
long startTime = System.currentTimeMillis();
Log.d("ImageManager", "download begining");
Log.d("ImageManager", "download url:" + url);
Log.d("ImageManager", "downloaded file name:" + fileName);
/* Open a connection to that URL. */
URLConnection ucon = url.openConnection();
/*
* Define InputStreams to read from the URLConnection.
*/
InputStream is = ucon.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
/*
* Read bytes to the Buffer …
Run Code Online (Sandbox Code Playgroud) 我创建webDialog
发送好友请求的facebook
.我是能够创造网络对话和发送好友请求,但我不知道解析捆绑date.Once请求被发送,如果没有错误我得到的回应facebook
中以下方式Bundle [{to [0] = 100005695389624,to [1] = 100002812207673,request = 333965433373671}].我想解析这些数据.我怎么能这样做.
我可以request
从上面的数据中得到但是如何从中获取to
参数.如果有人有任何想法,请告诉我.
我试着用以下方式.
final String requestId = values.getString("request"); // This value retrieved properly.
char at[] = values.getString("to").toCharArray(); // returns null
String str[] = values.getStringArray("to"); // returns null
String s = values.getString("to"); // return null
Run Code Online (Sandbox Code Playgroud) 我已经为TextView设置了监听器,但它无法工作.我想在点击文本时启动活动.我已经放置了我的代码,任何人都可以建议我进行任何更改.
// This is my code
public void onClick(View v) {
// TODO Auto-generated method stub
int i = v.getId();
//String roomName = textView[i].getText().toString();
//Intent intentDeviceOperation = new Intent(v.getContext),DeviceOperation.class);
//startActivity(intentDeviceOperation);
//Intent i1 = new Intent(v.RoomForSpecificUser.this,DeviceOperation.class);
//RoomForSpecificUser.this.startActivityForResult(i1,7);
Intent ii = new Intent();
ii.setClass(RoomForSpecificUser.this, DeviceOperation.class);
}
Run Code Online (Sandbox Code Playgroud)
它没有开始另一个活动,甚至没有得到任何错误.
实际上,当我创建数据库时,代码运行良好,我的第一个表(table_userprofile)及其相关字段.
但是一旦我onCreate()
在Helper Class中的方法下创建了另一个表(table_bloodgroup).
它开始显示第二个表没有创建..并且弹出了许多与未创建数据库相关的异常.
以下是CODE:
package com.example.databaseexample;
import java.util.ArrayList;
import java.util.List;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
public class DatabaseHelper extends SQLiteOpenHelper {
// All Static variables
// Database Version
private static final int DATABASE_VERSION = 1;
// Database Name
private static final String DATABASE_NAME = "bloodDonation";
// Contacts table name
private static final String TABLE_USER="table_userprofile";
private static final String TABLE_BLOODGROUP="table_bloodgroup";
//UserProfile Table Columns names
private static final String KEY_ID="id";
private static …
Run Code Online (Sandbox Code Playgroud) 我使用以下命令生成MD5 cetificate.但是我获得了SHA1证书.在生成证书时,这会产生无效的指纹.我在做错的地方.
keytool -list -alias androiddebugkey -keystore ./.android/debug.keystore
您好我想通过单击按钮捕获图像,拍完照片后,它将显示在屏幕上,然后单击另一个按钮,将该图像发送到服务器.我在很多方面尝试过,但我没有找到任何合适的解决方案,所以请帮助我.
我在android 2.3.3中开发这个
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
Bitmap photo = (Bitmap) data.getExtras().get("data");
imageView.setImageBitmap(photo);
Intent intent= getIntent();
System.out.println("image name=========================:: "+imageName);
requestIntent.putExtra("imageName", imageName);
startActivity(requestIntent);
} else if (resultCode == RESULT_CANCELED) {
// User cancelled the image capture
} else {
// Image capture failed, advise user
}
}
}
Run Code Online (Sandbox Code Playgroud)
图像没有显示在那里ImageView
但存储在SdCard
.当我通过调用另一个意图发送该图像时,它向我显示错误,即11-01 12:00:15.085: E/log_tag(9205): Error in http connection android.os.NetworkOnMainThreadException
该意图代码是.
public class PreviewAndSendImage extends …
Run Code Online (Sandbox Code Playgroud)