我需要在两个位置之间获得距离,但我需要像图中的蓝线一样得到距离.

我接下来尝试:
public double getDistance(LatLng LatLng1, LatLng LatLng2) {
double distance = 0;
Location locationA = new Location("A");
locationA.setLatitude(LatLng1.latitude);
locationA.setLongitude(LatLng1.longitude);
Location locationB = new Location("B");
locationB.setLatitude(LatLng2.latitude);
locationB.setLongitude(LatLng2.longitude);
distance = locationA.distanceTo(locationB);
return distance;
}
Run Code Online (Sandbox Code Playgroud)
但我得到红线距离.
我有 sqlite database
private static final String DB_PROCESS_CREATE = "create table "
+ DB_TABLE_PROCESS + "(" + PROCESS_ID
+ " integer primary key autoincrement, "
+ PROCESS_DATE + " date);";
Run Code Online (Sandbox Code Playgroud)
我创造它 db.execSQL(DB_PROCESS_CREATE);
如何在此数据库中添加日期值?我试过了 :
String date = new SimpleDateFormat("yyyy.MM.dd").format(Calendar
.getInstance().getTime());
ContentValues cv = new ContentValues();
cv.put(db.PROCESS_DATE,Date.valueOf(date));
db.mDB.insert(db.DB_TABLE_PROCESS, null, cv));
Run Code Online (Sandbox Code Playgroud)
但后来我得到error:
"The method put(String, String) in the type ContentValues is not applicable for the arguments (String, Date)".
Run Code Online (Sandbox Code Playgroud) Android工作室不能在Windows 8中运行.我下载它,安装,但是当我按下图标运行它时 - 没有任何反应.我尝试与管理员一起运行.我尝试设置与Windows 7的兼容性.
我有一些问题,我的应用程序工作正常,但当我在Play市场加载它时,地图无法正常工作.我做下一个:
keytool -list -v -keystore C:\User\Name/.android/debug.keystore -alias androiddebugkey -storepass android -keypass androidSHA1;com.kostya.app我的错误在哪里?我读了这篇文章.我们可以一起创建一个很好的教程,如何使用谷歌地图v2签署应用程序.如何在加载到游戏市场后立即测试应用程序,而不需要考虑我们的应用程序.
我想用Facebook登录我的应用程序,但是我收到了Logcat的下一条消息:
Failed to find provider info for com.facebook.katana.provider.PlatformProvider
Run Code Online (Sandbox Code Playgroud)
和启动器不加载.我得到我的哈希键这样.
我的代码是:
case R.id.btn_start_facebook:
// callback when session changes state
// start Facebook Login
Session.openActiveSession(this, true, new Session.StatusCallback() {
// callback when session changes state
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (session.isOpened()) {
// make request to the /me API
Request.executeMeRequestAsync(session,
new Request.GraphUserCallback() {
// callback after Graph API response
// with user object
@Override
public void onCompleted(GraphUser user,
Response response) {
if (user != …Run Code Online (Sandbox Code Playgroud) 我使用Android 2.1,我想从相机意图结果获得真正的路径.我从ACTION_IMAGE_CAPTURE Intent读取了Get Path of image,但是它适用于android 2.2.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == CAMERA_RESULT)
{
Bitmap thumbnail = (Bitmap) data.getExtras().get("data");
imv.setImageBitmap(thumbnail);
Uri selectedImageUri = data.getData();
String path = getRealPathFromURI(selectedImageUri);
}
}
private String getRealPathFromURI(Uri contentUri)
{
try
{
String[] proj = { MediaStore.Images.Media.DATA };
Cursor cursor = managedQuery(contentUri, proj, null, null, null);
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
return cursor.getString(column_index);
}
catch (Exception e)
{
return contentUri.getPath();
}
}
Run Code Online (Sandbox Code Playgroud) 我需要像这样做一些思考: 
如何选择蓝色的电话号码,并在其上点击聆听?我不想为它创建其他textView.我试过了:
@Override
public void onClick(View v) {
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:+" + tv.getText().toString().trim()));
startActivity(callIntent);
}
Run Code Online (Sandbox Code Playgroud) 当wifi打开时 - 所有工作,但当它关闭 - 我得到nullPointer异常
package ua.khuta.myskidka;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.database.Cursor;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
public class FragmentNews extends Fragment {
private View v;
ListView lvNews;
Database db;
mySCadapter scAdapter;
public String DEBUG_TAG = "myLogs";
String[] from = new String[] { Database.NEWS_TITLE, Database.NEWS_IMAGE_URL,
Database.NEWS_SHORT_DESCRIPTION };
int [] to = new int[] { R.id.item_news_tv_title, R.id.item_news_iv_image,
R.id.item_news_tv_short_description };
@Override
public …Run Code Online (Sandbox Code Playgroud) 我明白了
FATAL EXCEPTION: main
java.lang.NoSuchMethodError: android.widget.ImageView.setBackground
at ua.khuta.mobilereception.ProfileActivity.onCreate(ProfileActivity.java:117)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1919)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
at android.app.ActivityThread.access$600(ActivityThread.java:122)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4340)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Run Code Online (Sandbox Code Playgroud)
在这一行
imageView.setBackground(new BitmapDrawable(getResources(),k));
Run Code Online (Sandbox Code Playgroud)
所有在Android 4.4.2上工作正常,但它不适用于较低版本.我的部分内容是
<uses-sdk android:minSdkVersion="10"
android:targetSdkVersion="17"/>
Run Code Online (Sandbox Code Playgroud)