这里我有一个以编程方式添加用户的代码。在代码中,第5行和第5行中有public class MainActivity extends ListActivity {
List<Movie> movieList;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RestAdapter restAdapter = new RestAdapter.Builder()
.setEndpoint("http://api.themoviedb.org/3")
.setRequestInterceptor(new RequestInterceptor() {
@Override
public void intercept(RequestFacade request) {
request.addEncodedQueryParam("sort_by", "popularity.des");
request.addEncodedQueryParam("api_key","YOURAPIKEY");
}
})
.setLogLevel(RestAdapter.LogLevel.FULL)
.build();
MovieAPI service = restAdapter.create(MovieAPI.class);
service.getPopularMovies(new Callback<MoviesResponse>() {
@Override
public void success(MoviesResponse moviesresponse, Response response) {
movieList = moviesresponse.getResults();
movieList = moviesresponse.getResults();
adapter adapt = new adapter(getApplicationContext(),R.layout.item_file,movieList);
setListAdapter(adapt);
}
@Override
public void failure(RetrofitError error) {
Toast.makeText(MainActivity.this, error.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
。 6这是一个类,所以如果有人有该类的代码,那么请分享。此代码可在James Falkner的Liferay博客中找到。代码是:
SocialDriverConstants
我在哪里可以找到那个班级?
答案 0 :(得分:0)
评论James' blog article(正如其他人已经做过的那样,查看那里的评论)而不是在一个不相关的地方评论可能更有意义,例如堆栈溢出。他比他在互联网上的其他地方更有可能阅读他自己博客文章的评论。
话虽这么说,根据您发布的代码使用它的假设,即生成随机名称/作业标题,应该很容易找到该类的替换。只需为它们生成任何随机内容,以便满足它们使用的API(在这种情况下:addUser
)