注意:我不想将图像附加到电子邮件中
我想在电子邮件正文中显示图片,
我已经尝试了HTML图像标记<img src=\"http://url/to/the/image.jpg\">"
,我得到了输出,你可以在我的问题中看到如何在电子邮件正文中添加图像,所以我累了Html.ImageGetter
.
它对我不起作用,它也给了我相同的输出,所以我怀疑是否可以这样做,
我的代码
Intent i = new Intent(Intent.ACTION_SEND);
i.putExtra(Intent.EXTRA_EMAIL,new String[] {"abc@gmail.com"});
i.putExtra(Intent.EXTRA_TEXT,
Html.fromHtml("Hi <img src='http://url/to/the/image.jpg'>",
imgGetter,
null));
i.setType("image/png");
startActivity(Intent.createChooser(i,"Email:"));
private ImageGetter imgGetter = new ImageGetter() {
public Drawable getDrawable(String source) {
Drawable drawable = null;
try {
drawable = getResources().getDrawable(R.drawable.icon);
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(),
drawable.getIntrinsicHeight());
} catch (Exception e) {
e.printStackTrace();
Log.d("Exception thrown",e.getMessage());
}
return drawable;
}
};
Run Code Online (Sandbox Code Playgroud)
更新1:如果我使用ImageGetter
代码TextView
我能够获取文本和图像,但我无法在电子邮件正文中看到图像
这是我的代码:
TextView t = null;
t = (TextView)findViewById(R.id.textviewdemo); …
Run Code Online (Sandbox Code Playgroud) 如何在向接收方发送短信时隐藏/更改发件人的手机号码.
例如,如果我将短信发送到某个号码1234567890,接收方可以在不知道我的号码的情况下接收我的短信.
我已经完成了Stack Overflow中的几个问题,并提到隐藏/更改发件人编号是不可能的.
但我可以在Android市场上看到一些隐藏发件人短信号码的应用程序.
注意:在应用程序中,他们已经明确提到了
您的网络运营商必须支持隐藏您的来电显示.
我想知道美国的网络提供商是否支持此选项.另外,我如何才能找到我的网络提供商支持这个以及我必须使用哪些API来隐藏发件人的手机号码?
如果我对此有任何线索,那将是非常棒的
以下是现有问题
这是App Link
我有一个图像视图,我写过刷卡,在刷卡的时候,图像从互联网上下载,所以我想我必须在刷卡之前在后台下载图像,因为我需要使用asynctask或Service或IntentService,所有这些都有助于下载和存储在数据/数据/ mypackages中,但仍然在我的情况下刷卡任何想法,也告诉我哪一个是最好的,是我正在以正确的方式调用
asynctask
2.服务
3.意向服务如下图所示,
我很困惑哪一个是正确的方法,因为我的问题仍未解决
这是asynctask代码示例代码段
public class Demo extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
new FirstTask().execute(); // calling Asynctask here
}
Run Code Online (Sandbox Code Playgroud)
}
异步任务代码
private class FirstTask extends AsyncTask<Void, Void, Void> {
private final ProgressDialog dialog = new ProgressDialog(Catalogue.this);
int temp = 0;
// can use UI thread here
protected void onPreExecute() {
this.dialog.setMessage("Loading...");
this.dialog.setCancelable(false);
//this.dialog.show();
System.gc();
Toast.makeText(Catalogue.this, "My Async Created",
Toast.LENGTH_LONG).show();
}
@Override
protected Void doInBackground(Void... params) {
Looper.prepare();
try {
myddownloadmethod();// …
Run Code Online (Sandbox Code Playgroud) 我正在解析一个网站,以显示URL中的内容,因为有些图像在那里.我想裁剪从网站解析的图像.我真的很挣扎,有人可以帮我解决这个问题吗?
我想在之后d/mm/yyyy
,之后d/mm/yyyy
或之前的某些日期检索记录,d/mm/yyyy
我该怎么办呢?
SELECT date
FROM table
WHERE date > 1/09/2008;
Run Code Online (Sandbox Code Playgroud)
和
SELECT date
FROM table
WHERE date > 1/09/2008;
AND date < 1/09/2010
Run Code Online (Sandbox Code Playgroud)
它不起作用.
package jexcel.jxl.nimit;
import java.awt.Label;
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.CellType;
import jxl.LabelCell;
import jxl.NumberCell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.write.WritableCell;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class ExcelJxl {
/**
* @param args
* @throws IOException
* @throws BiffException
* @throws WriteException
* @throws RowsExceededException
*/
public static void main(String[] args) throws BiffException, IOException, RowsExceededException, WriteException {
// TODO Auto-generated method stub
ExcelJxl.WriteFile("D:\nimit.xls");
}
public static void WriteFile(String path) throws BiffException, IOException, RowsExceededException, …
Run Code Online (Sandbox Code Playgroud) 我可以得到圆形的中心点,所以我想在圆形的中心点周围绘制一些按钮,如图所示http://i.6.cn/cvbnm/50/97/b0/e7ed11251c3069fea4130c74b3ecb10c .png ,你能给我一些建议,链接到例子会更有用.这是我的代码
编辑:
public class drawCirPicture extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(new SampleView(this));
}
private static class SampleView extends View {
private Bitmap mBitmap;
public SampleView(Context context) {
super(context);
setFocusable(true);
InputStream is = context.getResources().openRawResource(android.R.drawable.sym_call_outgoing);
mBitmap = BitmapFactory.decodeStream(is);
}
@Override protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.GRAY);
Paint p = new Paint();
float centerY = 200;
float centerX=130;
double alpha = 0,wedge=0;
double PI=Math.PI;
float x,y; …
Run Code Online (Sandbox Code Playgroud) 我已经下载了蓝牙聊天应用程序的android示例,使用蓝牙在两个Android设备之间发送文本.
我在两个Android设备上安装并运行了这个应用程序.
我在那段代码中遇到了很多问题
1.清除服务发现失败异常:
对于服务发现失败的异常,在蓝牙聊天服务中,我检查了sdk版本和sdk版本大于Ginger Bread,
我已经使用Method类来调用RfCOMM套接字连接,并且我的第一个异常在这种方法中得到了解决.
例外代码
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
Run Code Online (Sandbox Code Playgroud)
修复了异常代码
try {
if (Build.VERSION.SDK_INT < 9) {
try {
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
} catch (IOException e1) {
e1.printStackTrace();
}
} else {
Method m = null;
try {
m = device.getClass().getMethod("createRfcommSocket",
new Class[] { int.class });
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
try {
tmp = (BluetoothSocket) m.invoke(device, 1);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} …
Run Code Online (Sandbox Code Playgroud) 我编写了一个代码,它能够成功找到配对的OBD并与ELM327建立连接,但是当我尝试发送ATZ命令时,应用程序崩溃了.
这是代码片段,我可能做错了
public HashMap<String, String> startOBDCommunicator(
BluetoothSocket btSocketConnected, String paramClassName,
String methodName) {
HashMap<String, String> dataRetriever = new HashMap<String, String>();
sendDataToOBD(btSocketConnected, "ATZ\r");
dataRetriever.put("Reset", readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATS0\r");
dataRetriever.put("Space Control", readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATE0\r");
dataRetriever.put("Echo control", readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATL0\r");
dataRetriever.put("Line feed", readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATAT0\r");
dataRetriever
.put("Adaptive Timing", readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATST10\r");
dataRetriever.put("Time Out", readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATI\r");
dataRetriever.put("Device Description",
readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATDP\r");
dataRetriever.put("Protocol Information1",
readDataFromOBD(btSocketConnected));
sendDataToOBD(btSocketConnected, "ATSPA0\r");
dataRetriever
.put("Auto Protocol",
readBytesFromOBD(btSocketConnected, paramClassName,
methodName));
sendDataToOBD(btSocketConnected, "010C\r");
dataRetriever
.put("RPM param",
readBytesFromOBD(btSocketConnected, paramClassName,
methodName));
sendDataToOBD(btSocketConnected, "010D\r");
dataRetriever
.put("Speed …
Run Code Online (Sandbox Code Playgroud)