不点击任何按钮,如何直接获取当前位置并将相机移动到它.
另外,我发现地图右上方有一个按钮.单击它时,它将转到当前位置.单击该按钮时如何获取返回的位置?
运用
mMap.setMyLocationEnabled(true)
Run Code Online (Sandbox Code Playgroud)
可以设置myLocation层启用.
但问题是当用户点击按钮时如何获取myLocation?我想得到经度和纬度.
如果我想从原生相机捕捉图像,我可以这样做:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
startActivityForResult(intent, IMAGE_CAPTURE);
Run Code Online (Sandbox Code Playgroud)
如果我想从图库中获取图像,我可以这样做:
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,
"Select Picture"), SELECT_PICTURE);
Run Code Online (Sandbox Code Playgroud)
我想知道如何把上面两个放在一起.
这意味着从画廊或捕捉照片获取图像
有没有示例代码可以做到这一点?谢谢.
这是我的示例代码:
package newslab.video.server;
import android.app.Activity;
import android.hardware.Camera;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class VideoServer extends Activity implements SurfaceHolder.Callback {
TextView testView;
Camera camera;
SurfaceView surfaceView;
SurfaceHolder surfaceHolder;
private final String tag = "VideoServer";
Button start, stop;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
start = (Button)findViewById(R.id.btn_start);
start.setOnClickListener(new Button.OnClickListener() {
public void onClick(View arg0) {
start_camera();
}
});
stop = (Button)findViewById(R.id.btn_stop); …
Run Code Online (Sandbox Code Playgroud) 在logcat中,它总是注销"FimgApiStretch:stretch failed".
特别是当我使用listview时.
但它永远不会崩溃或强迫关闭.
谁知道是什么原因?
对于普通的Activity,我可以设置一些断点并在Eclipse中单击F11进行调试.但是,当我开发app小部件时,它无法正常工作.那么,我该如何调试?
我有一个应用程序小部件,可以onUpdate()
在我的提供程序中接收click事件.
但是,当我尝试强制关闭主启动器时,单击事件将丢失.
我甚至把断点在所有的onEnabled()
,onReceived()
...等:连接似乎丢失.
因此,我如何"重新连接"按钮事件?
WidgetProvider扩展AppWidgetProvider
:
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
Log.d(TAG, "onUpdate()");
Log.d(TAG, "isLoading: " + CONSTANT.isLoading);
// update each of the widgets with the remote adapter from updateService
// Get all ids
ComponentName thisWidget = new ComponentName(context, ScoreWidgetProvider.class);
int[] allWidgetIds = appWidgetManager.getAppWidgetIds(thisWidget);
// Build the intent to call the service
Intent intent = new Intent(context.getApplicationContext(), UpdateWidgetService.class);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, allWidgetIds);
// Update the widgets via the service
context.startService(intent); …
Run Code Online (Sandbox Code Playgroud) 例如:
int width = 720;
int height = 1280;
Run Code Online (Sandbox Code Playgroud)
我想创建一个Camera.Size.
Camera.Size size = new Camera.Size(width,height);
Run Code Online (Sandbox Code Playgroud)
但它有一些错误.
No enclosing instance of type Camera is accessible. Must qualify the allocation with an enclosing instance of type Camera (e.g. x.new A() where x is an instance of Camera).
Run Code Online (Sandbox Code Playgroud) 对于很长的时间,我认为是在Android中使用的片段,如果我只是开发的应用程序的原因,Android Phone
只而不是10.1
.
是否有必要使用片段?另外,片段的用法是什么,我发现它可以用于'tab'和'separate view'......
我真的觉得这很混乱.谁能简单解释并举例说明?
我有一个缩略图,当用户点击该图像时,
它会弹出(窗口或对话框??)以显示大图像.
(窗口或对话框)背景应该是透明的.
有没有教程?