小编Ani*_*M H的帖子

如何在android中获取当前位置的经纬度

在我的应用程序中,我在应用程序打开时获取当前位置的纬度和经度,但在应用程序关闭时则不会.

我正在使用Service类来获取我的应用程序中的当前位置纬度和经度.

即使应用程序关闭,请告诉我如何获取当前位置的纬度和经度

android android-service android-location

67
推荐指数
4
解决办法
25万
查看次数

这个警告是什么:忽略没有关联的EnclosingMethod属性的匿名内部类的InnerClasses属性

我创建了3个布局HDPI和MDPI和LDPI,我编辑了xml文件中的任何一个,在控制台中,它们显示错误:

警告:忽略没有关联的EnclosingMethod属性的匿名内部类的InnerClasses属性.(这个类可能是由一个破碎的编译器产生的.)

android android-layout

38
推荐指数
1
解决办法
4万
查看次数

如何在Android中更改日期时间格式?

我使用以下格式在Android中显示日期和时间:
2013-06-18 12:41:24

如何将其更改为以下格式?
18-jun-2013 12:41 pm

android

22
推荐指数
4
解决办法
5万
查看次数

在android应用程序启动时添加加载屏幕

我的应用程序在10秒内加载起始页面.在那个10秒的时间内,android屏幕是空白的.那时我想添加加载屏幕.如何添加?并在应用程序中告诉我如何知道起始页面正在加载?并告诉我如何在我的应用程序中做?

android android-applicationinfo

19
推荐指数
3
解决办法
9万
查看次数

如何将气泡添加到textview android?

在我的应用程序中,我想将气泡设置为文本视图,在我添加的文本视图中setBackgroundResource(),您可以在代码中看到.

使用此代码我得到这样的图像:

在此输入图像描述

我想要一个像这样的气泡形状图像:

在此输入图像描述

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
    <solid android:color="#EDF5E4" />
    <corners android:bottomLeftRadius="@dimen/corner_radius"
    android:bottomRightRadius="@dimen/corner_radius"
    android:topLeftRadius="@dimen/corner_radius"
    id:topRightRadius="@dimen/corner_radius" />
Run Code Online (Sandbox Code Playgroud)

请告诉我如何在我的setBackgroundResource()XML中进行此操作.

android nine-patch android-custom-view android-intent

17
推荐指数
1
解决办法
3万
查看次数

如何将图像添加到Android中的AlertDialog?

我创建了一个AlertDialog,它是两个选项,一个是开放式摄像头,另一个是画廊

如图所示
在此输入图像描述

但我需要像这样添加相机和图库图像

在此输入图像描述

如何添加图像就是这段代码

    final String [] items   = new String [] {"Take from camera", "Select from gallery"};    
      ArrayAdapter<String> adapter  = new ArrayAdapter<String> (this, android.R.layout.select_dialog_item,items);
      AlertDialog.Builder builder   = new AlertDialog.Builder(this);

      builder.setTitle("Select Image");
      builder.setAdapter( adapter, new DialogInterface.OnClickListener() {
      public void onClick( DialogInterface dialog, int item ) { //pick from camera
      if (item == 0) {
      Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);

      mImageCaptureUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(),
      "tmp_avatar_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));

      intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mImageCaptureUri);

      try {
      intent.putExtra("return-data", true);

      startActivityForResult(intent, PICK_FROM_CAMERA);
      } catch (ActivityNotFoundException e) …
Run Code Online (Sandbox Code Playgroud)

android android-intent android-image android-alertdialog

2
推荐指数
1
解决办法
8686
查看次数

将文本转换为超链接,分配给UILabel

在下面的代码中,我正在检测字符串中的url.现在我需要只将超链接放到检测到的"url"并指定UILabel 每当我点击这个url它应该去浏览器,怎么做?

码:

NSString *string = descPost.text;
NSDataDetector *linkDetector = [NSDataDetector dataDetectorWithTypes:NSTextCheckingTypeLink error:nil];
NSArray *matches = [linkDetector matchesInString:string options:0 range:NSMakeRange(0, [string length])];
for (NSTextCheckingResult *match in matches)
{
    if ([match resultType] == NSTextCheckingTypeLink)
    {
        NSURL *url = [match URL];
        NSLog(@"found URL: %@", url);
    }
}
Run Code Online (Sandbox Code Playgroud)

cocoa-touch objective-c ios

2
推荐指数
1
解决办法
953
查看次数

在android中我在Geocoder中获得IOException

如果网络不可用或发生任何其他I/O问题,它会抛出IOException.它需要互联网连接才能使用Geocoder.

   public class MainActivity extends Activity {

   double LATITUDE = 37.42233;
   double LONGITUDE = -122.083;

   /** Called when the activity is first created. */
   @Override
    public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_main);
   TextView myLatitude = (TextView)findViewById(R.id.mylatitude);
   TextView myLongitude = (TextView)findViewById(R.id.mylongitude);
   TextView myAddress = (TextView)findViewById(R.id.myaddress);

   myLatitude.setText("Latitude: " + String.valueOf(LATITUDE));
   myLongitude.setText("Longitude: " + String.valueOf(LONGITUDE));

   Geocoder geocoder = new Geocoder(this, Locale.ENGLISH);

   try {
   List<Address> addresses = geocoder.getFromLocation(LATITUDE, LONGITUDE, 1);

   if(addresses != null) {
   Address returnedAddress = addresses.get(0);
   StringBuilder strReturnedAddress = new StringBuilder("Address:\n");
   for(int …
Run Code Online (Sandbox Code Playgroud)

android

1
推荐指数
1
解决办法
8179
查看次数

如何获取待处理的本地通知

应用程序如何获取有关本地ios通知的信息.具体来说,如何取消属于Facebook等特定应用的所有待处理本地通知.

cocoa objective-c ios

-1
推荐指数
1
解决办法
647
查看次数