小编Liz*_*oan的帖子

RestAdapter Retrofit(2.0.2) 无法解析符号 android studio

我正在开发一个从 soundcloud 中选取数据的项目,但我似乎无法解决这个问题。请帮我。

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile files('libs/gson-2.6.2.jar')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'com.squareup.retrofit2:retrofit:2.0.2'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.squareup.retrofit2:converter-gson:2.0.2'
}
Run Code Online (Sandbox Code Playgroud)

这是我的代码

RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(Config.API_URL).build();
        SCService scService = restAdapter.create(SCService.class);
        scService.getRecentTracks(new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(new Date()), new Callback<List<Track>>() {
            @Override
            public void onResponse(Call<List<Track>> call, Response<List<Track>> response) {
                Log.d(TAG, "First track title: " + tracks.get(0).getTitle());
            }

            @Override
            public void onFailure(Call<List<Track>> call, Throwable t) {
                Log.d(TAG, "Error: " + error);
            }
        });
Run Code Online (Sandbox Code Playgroud)

请帮忙!

java android retrofit retrofit2

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

反转整个String并反转其中的每个单词

我必须编写一个包含两个类的代码,一个反转字符串改变位置,例如

I love youuoy evol I

而另一个类在不改变位置的情况下反转字符串,例如

I love you成为I evol uoy.

我有一个小代码,但是如果在这些类中调用方法,我就无法找到方法.

我现在拥有的只是以第一种方式反转字符串的代码.欢迎任何帮助.

class StringReverse2{
    public static void main(String[] args){

        String string="I love you";
        String reverse = new StringBuffer(string).  //The object created through StringBuffer is stored in the heap and therefore can be modified
        reverse().toString();                       //Here the string is reversed

        System.out.println("Old String:"+string);   //Prints out I love you
        System.out.println("New String : "+reverse);//Prints out the reverse  that is "uoy evol I"
    }
}
Run Code Online (Sandbox Code Playgroud)

java methods

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

标签 统计

java ×2

android ×1

methods ×1

retrofit ×1

retrofit2 ×1