本文整理匯總了Java中com.parse.ParseUser.getUsername方法的典型用法代碼示例。如果您正苦於以下問題:Java ParseUser.getUsername方法的具體用法?Java ParseUser.getUsername怎麽用?Java ParseUser.getUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.parse.ParseUser
的用法示例。
在下文中一共展示了ParseUser.getUsername方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: computeUserName
import com.parse.ParseUser; //導入方法依賴的package包/類
public String computeUserName()
{
ParseUser user = getParseUser("user");
if (user != null)
{
try
{
user.fetchIfNeeded();
return user.getUsername();
}
catch (ParseException e)
{
e.printStackTrace();
}
}
return "N/A";
}
示例2: getUsername
import com.parse.ParseUser; //導入方法依賴的package包/類
@Nullable
public String getUsername() {
if(isLoggedIn()) {
ParseUser currentUser = ParseUser.getCurrentUser();
if(ParseFacebookUtils.isLinked(currentUser)) {
return currentUser.getString("name");
} else {
return currentUser.getUsername();
}
} else {
return null;
}
}
示例3: onCreate
import com.parse.ParseUser; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
mRecyclerView = (RecyclerView) findViewById(R.id.activityProfileRecyclerView);
mLayoutManager = new LinearLayoutManager(this);
mRecyclerView.setLayoutManager(mLayoutManager);
activateToolbar();
context = this;
followerButton = (Button) findViewById(R.id.followerButton);
followingButton = (Button) findViewById(R.id.followingButton);
profilePic = (CustomImageView) findViewById(R.id.profilePic);
usernameTv = (TextView) findViewById(R.id.profileUsername);
ParseUser currentUser = ParseUser.getCurrentUser();
// init this user's own wubble list
if (currentUser != null) {
String currentUserName = currentUser.getUsername();
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Wubbles");
query.whereEqualTo("User", currentUserName);
query.orderByDescending("createdAt");
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> wubbles, ParseException e) {
if (e == null) {
myWubbles = wubbles;
adapter = new ProfileRecyclerAdapter(context, myWubbles);
mRecyclerView.setAdapter(adapter);
} else {
// handle problems here
}
}
});
}
}
示例4: getExportDirectory
import com.parse.ParseUser; //導入方法依賴的package包/類
/**
* Returns the export directory for a user with path like
* path/to/downloads/dir/SnackTrackExports/username/
*
* @param user Which user's export directory.
* @return The directory.
*/
public static File getExportDirectory(ParseUser user){
return new File(
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),
"SnackTrackExports/" + user.getUsername() + "/"
);
}