我正在尝试做一些我认为相对简单的事情:使用Android SDK将图像上传到服务器.我找到了很多示例代码:
http://linklens.blogspot.com/2009/06/android-multipart-upload.html
但是对我来说都不起作用.我一直遇到的困惑是制作多部分请求真正需要的东西.Android的多部分上传(带图片)的最简单方法是什么?
任何帮助或建议将不胜感激!
好的朋友......长话短说,我是在一台我无法访问的计算机上开发的.我能够检索源代码,但不能检索用于签署和发布我的应用程序到市场的.keystore文件(有几个更新).如果我想要更新,我和我的可怜的用户是否运气不好?
我知道用于签署密钥的密码(至少它是三个中的一个),所以我可以创建另一个密码吗?必须有办法解决这个问题..硬盘驱动器失败了怎么办?
我正在显示一个带有edittext视图的对话框.但是,仅当用户按下编辑视图内部时,才会打开软键盘.所以我尝试使用以下代码调用InputMethodManager.
InputMethodManager imm =
(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(dialogField,0);
Run Code Online (Sandbox Code Playgroud)
dialogField是输入字段.但是,我到底应该这样做呢?我在对话框的onStart()方法中尝试了它,但没有任何反应.我之前也尝试过请求对话框的焦点,但这没有任何改变.
我也试过这段代码
dialogField.setOnFocusChangeListener(new View.OnFocusChangeListener()
{
public void onFocusChange (View v, boolean hasFocus)
{
if (hasFocus)
{
Main.log("here");
dialogInput.getWindow().setSoftInputMode(
WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
/*
InputMethodManager mgr =
(InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(dialogField,0);
*/
}
}
});
Run Code Online (Sandbox Code Playgroud)
在两个版本中.但是没有软键盘会出现.Main.log只是一个日志,它向我显示该函数实际被调用.是的,它被称为.
在对话框打开之前,我可以使用SHOW_FORCED标志获取键盘.但是在退出时它不会关闭.而且我只能在显示对话框之前这样做.在任何回调中它也不起作用.
在Eclipse中构建Android项目时,Android SDK会出现如下错误:
错误:
Description Resource Path Location Type
1) Error generating final archive: Debug Certificate expired on 7/9/11 6:31 PM MapByLocation Unknown Android Packaging Problem
2)Error generating final archive: Debug Certificate expired on 7/9/11 6:31 PM PageCurlAnimation Unknown Android Packaging Problem
Run Code Online (Sandbox Code Playgroud)
我不知道该怎么解决.请帮我.
好的,我有一个扩展SurfaceView和覆盖的类
surfaceChanged - 只需调用startPreview
surfaceCreated - 打开相机,编辑params*,设置surfaceHolder
surfaceDestroyed - 调用stopPreview,释放相机
这一切都很有效,因为当方向是肖像:
来自surfaceCreated*
m_camera = Camera.open();
Camera.Parameters p = m_camera.getParameters();
if (getResources().getConfiguration().orientation !=
Configuration.ORIENTATION_LANDSCAPE)
{
p.set("orientation", "portrait");
// CameraApi is a wrapper to check for backwards compatibility
if (CameraApi.isSetRotationSupported())
{
CameraApi.setRotation(p, 90);
}
}
Run Code Online (Sandbox Code Playgroud)
但是,每次方向改变时,它都会调用Camera.open()......正如您所知,这是一项非常昂贵的操作,导致转换不是那么顺利.
当我强制定位到横向时,预览很棒.创建只调用一次,因为预览是横向的,相机始终是用户看到的.但是,我需要一种方法来设置纵向拍摄时实际拍摄的照片的方向.当我强制横向渲染时,表面永远不会被重新创建,并且当相机以纵向方式保持时,参数永远不会被设置.
那么如何才能完成以下任一项(专门)?
当方向发生变化时,保持 onDestroy和onCreate之间的m_camera,以便过渡平滑
强制风景和检测方向改变另一种方式...旋转最终的snaped图片,如果保持纵向.
此外,如果我离开基地,有人能指出我更好的方向吗?谢谢.
android smartphone orientation android-sdk-2.1 android-camera
我使用以下TextView
来显示其中的一些数据:
<TextView android:id="@+id/notificationText"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textSize="18sp"
android:inputType="textMultiLine"
android:maxLines="2"
android:layout_paddingRight="20dip"
android:textColor="#ffffff"/>
Run Code Online (Sandbox Code Playgroud)
我想将文本换行到下一行.我怎样才能做到这一点?
我是我的应用程序,我需要在Android浏览器中打开一个链接.此页面只能通过POST接收一些数据.我可以将这些参数(数据)添加到启动浏览器的意图吗?
你知道这是否可行?如果是的话,你能给我一个提示吗?
在SDK 1.5中,我使用PackageManager类使用PackageManager.addPackageToPreferred()将首选主屏幕设置为我的应用程序.在新的SDK(使用2.1)中,这已被弃用,因此我尝试使用addPreferredActivity()获得相同的结果,但它没有按预期工作.
一些必要的背景.我正在写一个锁屏替换应用程序,所以我希望主键启动我的应用程序(已经运行,因此具有禁用密钥的效果).当用户"解锁"屏幕时,我打算恢复映射,以便一切正常.
在我的AndroidManifest.xml中,我有:
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS">
</uses-permission>
Run Code Online (Sandbox Code Playgroud)
在我的代码中,我有以下代码段:
// Set as home activity
// This is done so we can appear to disable the Home key.
PackageManager pm = getPackageManager();
//pm.addPackageToPreferred(getPackageName());
IntentFilter filter = new IntentFilter("android.intent.action.MAIN");
filter.addCategory("android.intent.category.HOME");
filter.addCategory("android.intent.category.DEFAULT");
ComponentName[] components = new ComponentName[]
{
new ComponentName("com.android.launcher", ".Launcher")
};
Context context = getApplicationContext();
ComponentName component = new ComponentName(context.getPackageName(),
MyApp.class.getName());
pm.clearPackagePreferredActivities("com.android.launcher");
pm.addPreferredActivity(filter, IntentFilter.MATCH_CATEGORY_EMPTY,
components, component);
Run Code Online (Sandbox Code Playgroud)
由此产生的行为是,当我按下Home键时,应用程序选择器出现,这表示clearPackagePreferredActivities()调用有效但我的应用程序没有被添加为首选.此外,下面日志中的第一行说明了"删除Intent的首选活动":
04-06 02:34:42.379:INFO/PackageManager(1017):结果集已更改,丢弃Intent的首选活动{act = …
我有一个IntentService
需要将消息传递给Activity
.我知道有两种方法可以做到这一点.
sendBroadcast()
在Service
侧面使用,同时broadcastReciever
在Activity
接收消息的一侧注册.
传递Messenger
到服务side
,这将指向一个Handler
在Activity
一侧,这将是准备好接收来自服务该消息.
哪一个有利于哪个目的?或者两者都这样做?
android ×10
android-sdk-2.1 ×10
eclipse ×1
http ×1
keystore ×1
orientation ×1
seekbar ×1
smartphone ×1
textview ×1
word-wrap ×1