当前位置: 首页>>代码示例>>Java>>正文


Java Uri.withAppendedPath方法代码示例

本文整理汇总了Java中android.net.Uri.withAppendedPath方法的典型用法代码示例。如果您正苦于以下问题:Java Uri.withAppendedPath方法的具体用法?Java Uri.withAppendedPath怎么用?Java Uri.withAppendedPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.net.Uri的用法示例。


在下文中一共展示了Uri.withAppendedPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFileList

import android.net.Uri; //导入方法依赖的package包/类
public List<MetaFile2> getFileList() throws IOException, AuthenticationException {
    FTPClient ftp = Session.getInstance().getFTPClient(mUri);
    ftp.cwd(mUri.getPath()); 
    org.apache.commons.net.ftp.FTPFile[] listFiles = ftp.listFiles(); 

    if(listFiles==null)
        return null;
    ArrayList<MetaFile2> list = new ArrayList<MetaFile2>();
    for(org.apache.commons.net.ftp.FTPFile f : listFiles){
        if(!f.getName().equals("..")|| !f.getName().equals(".")){
            FTPFile2 sf = new FTPFile2(f , Uri.withAppendedPath(mUri, f.getName()));
            list.add(sf);   
        }
    }
    return list;
}
 
开发者ID:archos-sa,项目名称:aos-FileCoreLibrary,代码行数:17,代码来源:FTPRawLister.java

示例2: getContactsWithPush

import android.net.Uri; //导入方法依赖的package包/类
public Collection<ContactData> getContactsWithPush(Context context) {
  final ContentResolver resolver = context.getContentResolver();
  final String[] inProjection    = new String[]{PhoneLookup._ID, PhoneLookup.DISPLAY_NAME};

  List<String> pushNumbers = TextSecureDirectory.getInstance(context).getActiveNumbers();
  final Collection<ContactData> lookupData = new ArrayList<>(pushNumbers.size());

  for (String pushNumber : pushNumbers) {
    Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(pushNumber));
    Cursor lookupCursor = resolver.query(uri, inProjection, null, null, null);
    try {
      if (lookupCursor != null && lookupCursor.moveToFirst()) {
        final ContactData contactData = new ContactData(lookupCursor.getLong(0), lookupCursor.getString(1));
        contactData.numbers.add(new NumberData("TextSecure", pushNumber));
        lookupData.add(contactData);
      }
    } finally {
      if (lookupCursor != null)
        lookupCursor.close();
    }
  }
  return lookupData;
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:24,代码来源:ContactAccessor.java

示例3: onCreateLoader

import android.net.Uri; //导入方法依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    return new CursorLoader(this,
            // Retrieve data rows for the device user's 'profile' contact.
            Uri.withAppendedPath(ContactsContract.Profile.CONTENT_URI,
                    ContactsContract.Contacts.Data.CONTENT_DIRECTORY), ProfileQuery.PROJECTION,

            // Select only email addresses.
            ContactsContract.Contacts.Data.MIMETYPE +
                    " = ?", new String[]{ContactsContract.CommonDataKinds.Email
            .CONTENT_ITEM_TYPE},

            // Show primary email addresses first. Note that there won't be
            // a primary email address if the user hasn't specified one.
            ContactsContract.Contacts.Data.IS_PRIMARY + " DESC");
}
 
开发者ID:Luodian,项目名称:Shared-Route,代码行数:17,代码来源:LoginActivity.java

示例4: onCreateLoader

import android.net.Uri; //导入方法依赖的package包/类
/**
 * Loads a cursor to the list of build order names in the database for this tab's race
 * and expansion.
 */
@DebugLog
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    DbAdapter db = getDb();
    db.open();

    final String whereClause = DbAdapter.KEY_FACTION_ID + " = " + DbAdapter.getFactionID(mFaction)
            + " and " + DbAdapter.KEY_EXPANSION_ID + " = " + DbAdapter.getExpansionID(mCurrentExpansion);

    return new CursorLoader(getActivity(),
            Uri.withAppendedPath(BuildOrderProvider.BASE_URI, DbAdapter.TABLE_BUILD_ORDER),    // table URI
            new String[]{DbAdapter.KEY_BUILD_ORDER_ID, DbAdapter.KEY_NAME, DbAdapter.KEY_CREATED, DbAdapter.KEY_VS_FACTION_ID},    // columns to return
            whereClause,                                                                    // select clause
            null,                                                                            // select args
            DbAdapter.KEY_VS_FACTION_ID + ", " + DbAdapter.KEY_NAME + " asc");                // sort order
}
 
开发者ID:kiwiandroiddev,项目名称:starcraft-2-build-player,代码行数:21,代码来源:RaceFragment.java

示例5: getFilePath

import android.net.Uri; //导入方法依赖的package包/类
private static Uri getFilePath(Uri xmlLocation, String videoPath) {
    if (videoPath == null)
        return null;
    Uri parentUri = Utils.getParentUrl(xmlLocation);
    if(parentUri!=null && parentUri.getPath()!=null && !parentUri.getPath().isEmpty()){
        Uri xml = Uri.withAppendedPath(parentUri, videoPath);
        return xml;
    }
    return null;
}
 
开发者ID:archos-sa,项目名称:aos-MediaLib,代码行数:11,代码来源:XmlDb.java

示例6: getContentUri

import android.net.Uri; //导入方法依赖的package包/类
/**
* Gets the content:// URI from the given corresponding path to a file
*
* @param context
*            场景
* @param file
*            文件
* @return content Uri
*/
  public static Uri getContentUri(Context context, File file) {
      String filePath = file.getAbsolutePath();
      Cursor cursor = context.getContentResolver().query(
              MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
              new String[] { MediaStore.Images.Media._ID },
              MediaStore.Images.Media.DATA + "=? ",
              new String[] { filePath }, null);
      if (cursor != null && cursor.moveToFirst()) {
          int id = cursor.getInt(cursor
                  .getColumnIndex(MediaStore.MediaColumns._ID));
          Uri baseUri = Uri.parse("content://media/external/images/media");
          if (!cursor.isClosed()) {
              cursor.close();
          }
          return Uri.withAppendedPath(baseUri, "" + id);
      } else {
          if (file.exists()) {
              ContentValues values = new ContentValues();
              values.put(MediaStore.Images.Media.DATA, filePath);
              return context.getContentResolver().insert(
                      MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
          } else {
              return null;
          }
      }
  }
 
开发者ID:YMlion,项目名称:leisure-glance,代码行数:36,代码来源:UriUtil.java

示例7: insert

import android.net.Uri; //导入方法依赖的package包/类
@Override
public Uri insert(Uri uri, ContentValues values) {
    if (isEstadosUri(uri)) {
        long id = db.getWritableDatabase().insert(SQLEstadosHelper.DATABASE_TABLE,null,values);
        return Uri.withAppendedPath(ContentProviderContract.CONTENT_ESTADOS_URI, Long.toString(id));
    }
    else return null;
}
 
开发者ID:if710,项目名称:2017.2-codigo,代码行数:9,代码来源:SQLiteContentProvider.java

示例8: getView

import android.net.Uri; //导入方法依赖的package包/类
public static SynchronizedView getView(Context ctx, String name, Record record) {
	String appendedPath = "records/" + record.getId() + "/views/" + name;
	Uri contentUri = Uri.withAppendedPath(HVContentContract.CONTENT_URI, appendedPath);

	Cursor cursor = ctx.getContentResolver().query(
			contentUri,
		    new String[] { "query", "date_synced" },
		    null, null, null);

	SynchronizedView view = null;
	
	try {
           if (cursor.getCount() > 0) {
               cursor.moveToFirst();

               String serializedQuery = cursor.getString(0);
               long syncDateMillis = cursor.getLong(1);
              
               view = new SynchronizedView(
                   ctx,
                   record,
                   name,
                   XmlSerializer.read(ThingRequestGroup2.class, serializedQuery),
                   new Date(syncDateMillis));
           }
	} catch (Exception e) {
		throw new HVException("Could not get View.", e);
	}
	
	return view;
}
 
开发者ID:Microsoft,项目名称:healthvault-java-sdk,代码行数:32,代码来源:SynchronizedView.java

示例9: getRecordContactName

import android.net.Uri; //导入方法依赖的package包/类
public String getRecordContactName(Context context, String number)
  {
try
{
   	String contactName = "";
   	
   	Uri uri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
       Cursor cursor = contentResolver.query(uri, new String[]{PhoneLookup._ID,PhoneLookup.DISPLAY_NAME}, null, null, null);
	
       if(cursor.moveToFirst())
       {
           contactName = cursor.getString(cursor.getColumnIndex(PhoneLookup.DISPLAY_NAME));
       }
       
       if(cursor != null && !cursor.isClosed())
       {
           cursor.close();
       }
       
       return contactName;
}
catch (Exception e)
{
	Log.w("DatabaseManager", "getRecordContactName : " + context.getString(R.string.log_database_manager_error_request) + " : " + e);
	
	return null;
}
  }
 
开发者ID:vassela,项目名称:AC2RD,代码行数:29,代码来源:DatabaseManager.java

示例10: setUp

import android.net.Uri; //导入方法依赖的package包/类
@Before
public void setUp() {
  MockitoAnnotations.initMocks(this);

  uri = Uri.withAppendedPath(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, "123");
  fetcher = new ThumbFetcher(uri, opener);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:ThumbFetcherTest.java

示例11: downloadVideo

import android.net.Uri; //导入方法依赖的package包/类
private void downloadVideo(String pathvideo) {
    /*if (!(pathvideo.contains("fbcdn")))
    {
        Toast.makeText(getContext(), "Please Enter Only Video Url", Toast.LENGTH_LONG).show();
    }*/
    if(pathvideo.contains("story"))
    {
        homeFragment.getUrlfromUrlDownload(pathvideo);
    }
    else
    {
            File directory = new File(Environment.getExternalStorageDirectory() + File.separator + "FacebookVideos");
            directory.mkdirs();
            DownloadManager.Request request = new DownloadManager.Request(Uri.parse(pathvideo));
            request.allowScanningByMediaScanner();
            request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE);
            request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
            File root = new File(Environment.getExternalStorageDirectory() + File.separator + "Facebook Videos");
            int Number = pref.getFileName();
            Uri path = Uri.withAppendedPath(Uri.fromFile(root), "Video-" + Number + ".mp4");
            request.setDestinationUri(path);
            DownloadManager dm = (DownloadManager) getActivity().getSystemService(getActivity().DOWNLOAD_SERVICE);
            ArrayList<String> urldownloadFragmentList = (new HomeFragment()).getList();
            if(urldownloadFragmentList.contains(pathvideo))
            {
                Toast.makeText(getActivity().getApplicationContext(),"The Video is Already Downloading",Toast.LENGTH_LONG).show();
            }
            else
            {
                urldownloadFragmentList.add(pathvideo);
                dm.enqueue(request);
                Toast.makeText(getActivity().getApplicationContext(),"Downloading Video-"+Number+".mp4",Toast.LENGTH_LONG).show();
                Number++;
                pref.setFileName(Number);
            }
    }
}
 
开发者ID:adarshgumashta,项目名称:Facebook-Video-Downloader,代码行数:38,代码来源:UrlDownloadFragment.java

示例12: getContactsDetails

import android.net.Uri; //导入方法依赖的package包/类
protected Participant getContactsDetails(String address) throws IOException {
    Uri contactUri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(address));

    Cursor phones = deskDroidService.getApplicationContext().getContentResolver().query(contactUri,
            new String[]{
                    ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME,
                    "number",
                    ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI},
            null, null, null);
    Participant participant = new Participant();
    if (phones.moveToNext()) {
        participant.setName(phones.getString(phones.getColumnIndex(
                ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME)));
        participant.setPhoneNumber(phones.getString(phones.getColumnIndex("number")));

        String image_uri = phones.getString(phones.getColumnIndex(
                ContactsContract.CommonDataKinds.Phone.PHOTO_THUMBNAIL_URI));
        if (image_uri != null) {
            try (InputStream input = deskDroidService.getApplicationContext().
                    getContentResolver().openInputStream(Uri.parse(image_uri));
                 ByteArrayOutputStream buffer = new ByteArrayOutputStream()) {
                int nRead;
                byte[] data = new byte[16384];

                while ((nRead = input.read(data, 0, data.length)) != -1) {
                    buffer.write(data, 0, nRead);
                }

                buffer.flush();
                participant.setThumbnail(Base64.encodeToString(buffer.toByteArray(), Base64.DEFAULT));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    phones.close();
    return participant;
}
 
开发者ID:PacktPublishing,项目名称:Java-9-Programming-Blueprints,代码行数:39,代码来源:DeskDroidResource.java

示例13: onCreateLoader

import android.net.Uri; //导入方法依赖的package包/类
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String accountUuid = accountUuids[id];
    Account account = preferences.getAccount(accountUuid);

    String threadId = getThreadId(search);

    Uri uri;
    String[] projection;
    boolean needConditions;
    if (threadId != null) {
        uri = Uri.withAppendedPath(EmailProvider.CONTENT_URI, "account/" + accountUuid + "/thread/" + threadId);
        projection = PROJECTION;
        needConditions = false;
    } else if (showingThreadedList) {
        uri = Uri.withAppendedPath(EmailProvider.CONTENT_URI, "account/" + accountUuid + "/messages/threaded");
        projection = THREADED_PROJECTION;
        needConditions = true;
    } else {
        uri = Uri.withAppendedPath(EmailProvider.CONTENT_URI, "account/" + accountUuid + "/messages");
        projection = PROJECTION;
        needConditions = true;
    }

    StringBuilder query = new StringBuilder();
    List<String> queryArgs = new ArrayList<>();
    if (needConditions) {
        boolean selectActive = activeMessage != null && activeMessage.getAccountUuid().equals(accountUuid);

        if (selectActive) {
            query.append("(" + MessageColumns.UID + " = ? AND " + SpecialColumns.FOLDER_REMOTE_ID + " = ?) OR (");
            queryArgs.add(activeMessage.getUid());
            queryArgs.add(activeMessage.getFolderId());
        }

        SqlQueryBuilder.buildWhereClause(account, search.getConditions(), query, queryArgs);

        if (selectActive) {
            query.append(')');
        }
    }

    String selection = query.toString();
    String[] selectionArgs = queryArgs.toArray(new String[0]);

    String sortOrder = buildSortOrder();

    return new CursorLoader(getActivity(), uri, projection, selection, selectionArgs,
            sortOrder);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:51,代码来源:MessageListFragment.java

示例14: books

import android.net.Uri; //导入方法依赖的package包/类
public static Uri books() {
    return Uri.withAppendedPath(AUTHORITY_URI, MatcherUri.BOOKS);
}
 
开发者ID:orgzly,项目名称:orgzly-android,代码行数:4,代码来源:ProviderContract.java

示例15: notifyChange

import android.net.Uri; //导入方法依赖的package包/类
void notifyChange() {
    Uri uri = Uri.withAppendedPath(EmailProvider.CONTENT_URI, "account/" + account.getUuid() + "/messages");
    contentResolver.notifyChange(uri, null);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:5,代码来源:LocalStore.java


注:本文中的android.net.Uri.withAppendedPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。