我正在使用android内置摄像头拍照,然后将相同的图片附加到电子邮件,当我在1.6设备中测试此功能时,我能够在内置摄像头中命名要拍摄的图片,但在2.1中,图片是有一个名字,即由设备给出,
如何在2.1内置摄像头图像中提供用户定义的名称..
为了避免这个问题,我手动保存图像,但是当我尝试通过意图将图像作为位图返回,然后使用压缩方法将其保存到SD卡
此方法处理内置摄像头的结果
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
File file = new File(Environment.getExternalStorageDirectory()
+ "/test.png");
switch (requestCode)
{
case PHOTO_ACTION:
if (resultCode == RESULT_CANCELED)
{
addPhoto = false;
Toast.makeText(this, "Canceled ", Toast.LENGTH_LONG).show();
break;
} else if (resultCode == RESULT_OK)
{
Bundle b = data.getExtras();
Bitmap bm = (Bitmap) b.get("data");
FileOutputStream out;
try
{
out = new FileOutputStream(file);
bm.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
scanPhoto(file.toString());
out = null;
addPhoto = true;
} catch (Exception e)
{
e.printStackTrace(); …Run Code Online (Sandbox Code Playgroud) 我正在使用一个自定义列表视图.当我点击listview时,我没有获得onClick事件.
这是我的代码.
lvlList = (ListView)findViewById(R.id.lvlList);
lvlList.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> a, View v,int position, long id)
{
Toast.makeText(getBaseContext(), "Click", Toast.LENGTH_LONG).show();
}
});
lvlList.setAdapter(new OrderAdapter(getBaseContext()));
Run Code Online (Sandbox Code Playgroud)
private class OrderAdapter extends BaseAdapter
{
private LayoutInflater mInflater;
public OrderAdapter(Context context)
{
mInflater = LayoutInflater.from(context);
}
public View getView(int position, View convertView, ViewGroup parent)
{
ViewHolder holder;
if (convertView == null)
{
convertView = mInflater.inflate(R.layout.example, null);
holder = new ViewHolder();
holder.txtTest = (TextView) convertView.findViewById(R.id.txtTest);
convertView.setTag(holder);
}
else
{
holder = (ViewHolder) convertView.getTag();
} …Run Code Online (Sandbox Code Playgroud) 我想在我的Android应用程序中集成paypal支付功能.
如何通过借记卡和信用卡支付PayPal?
如果不可能?您能否通过借记卡和信用卡向我建议另一种选择?
我在Play商店中放了一个应用程序,我的朋友,运行4.1(Nexus 7),在尝试安装我的应用程序时收到以下消息:"您的设备与此版本不兼容".为什么会这样?请任何人帮助我.
Manifeast file
< ?xml version="1.0" encoding="utf-8"?>
< manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ibkr.pcg"
android:versionCode="3"
android:versionName="1.1">
< uses-sdk android:minSdkVersion="7"
android:targetSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" ></uses-permission>
<!-- C2DM Permissions Start -->
<!-- Only this application can receive the messages and registration result -->
<permission android:name="com.ibkr.pcg.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.ibkr.pcg.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<!-- End of the C2DM Permissions -->
<application android:icon="@drawable/pcgicon"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:name="MyApplication"
android:debuggable="true">
<activity android:name=".PriceCheckGuruSplash"
android:label="@string/app_name"> …Run Code Online (Sandbox Code Playgroud) 我从apk文件中提取了代码,而我能够在eclipse中查看java代码,我无法查看xml代码.
xml代码显示了一些垃圾代码.
先感谢您.
你好,我是一所工程师学校的学生,我想知道TTS(文本到语音)是否可以在Android的离线环境中工作。
我想在不显示"完整操作对话框"的情况下调用谷歌地图意图?
可能吗?这是我的代码.
String uri = "http://maps.google.com/maps?saddr=" + Utils.getLatitude(ShowDetails.this)+","+Utils.getLongitude(ShowDetails.this)+"&daddr="+userLatitude+","+userLongitude;
startActivity(new Intent(android.content.Intent.ACTION_DEFAULT, Uri.parse(uri)));
Run Code Online (Sandbox Code Playgroud)
我不想在调用谷歌地图意图时显示在下面的对话框中.任何帮助表示赞赏.

如何从数据库中获取信息.我想执行这一行
String nom = db.execSQL("select name from person where id='+id+'");
Run Code Online (Sandbox Code Playgroud)
任何人都可以纠正我这一行,从表格中获取人的姓名
我创建了报警演示.在那个演示中,我重复一个警报.我的演示中有一个问题.即使时间过去,我的警报也称为服务.我正在设置16:08:00的时间并调用该警报,以便在经过该时间后调用我的警报服务.请帮我停止此标准.
AlarmManager alarmManager = (AlarmManager)ctx.getSystemService(ctx.ALARM_SERVICE);
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 16);
calendar.set(Calendar.MINUTE, 8);
calendar.set(Calendar.SECOND, 0);
PendingIntent pi = createPendingIntent(ctx);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 24*60*60*1000, pi);
Run Code Online (Sandbox Code Playgroud)
CreatePendingIntent方法
private static PendingIntent createPendingIntent(Context context)
{
Intent myIntent = new Intent(context, MyAlarmService.class);
return PendingIntent.getService(context,0, myIntent, 0);
}
Run Code Online (Sandbox Code Playgroud) 在我的项目中,我的设计在我的Android HTC 2.3.4中运行良好但是在4.0.1我的屏幕没有显示完整(有些设计是从底部切割).为什么?