方法
public void loadUserInformation() {
final String mNumber = getActivity().getIntent().getStringExtra("Phone_Number");
DatabaseReference rootRef = FirebaseDatabase.getInstance().getReference();
DatabaseReference usesrRef = rootRef.child("Users").child(uid);
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
EditText Name = (EditText) rootView.findViewById(R.id.Name);
ImageView profilePic = (ImageView) rootView.findViewById(R.id.profilePic);
for (DataSnapshot postSnapshot: dataSnapshot.getChildren()) {
String image = postSnapshot.child("Image").getValue().toString();
Picasso.get().load(image).into(profilePic);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {
Toast.makeText(getActivity(), "Error Loading UserDetails", Toast.LENGTH_LONG).show();
}
};
usesrRef.addListenerForSingleValueEvent(eventListener);
}
String image = postsnapshot.child line ...
上的空指针异常数据库结构:
答案 0 :(得分:1)
改变这个:
class CameraViewController: UIViewController {
var outputURL: URL!
func startRecording() {
if movieOutput.isRecording == false {
let connection = movieOutput.connection(with: AVMediaType.video)
if (connection?.isVideoOrientationSupported)! {
connection?.videoOrientation = currentVideoOrientation()
}
if (connection?.isVideoStabilizationSupported)! {
connection?.preferredVideoStabilizationMode = AVCaptureVideoStabilizationMode.auto
}
let device = activeInput.device
if (device.isSmoothAutoFocusSupported) {
do {
try device.lockForConfiguration()
device.isSmoothAutoFocusEnabled = false
device.unlockForConfiguration()
} catch {
print("Error setting configuration: \(error)")
}
}
//EDIT2: And I forgot this
outputURL = tempURL()
movieOutput.startRecording(to: outputURL, recordingDelegate: self)
}
else {
stopRecording()
}
}
}
进入这个:
<?php
function sheets($spreadsheetID) {
$sheets = array();
// Load Google API library and set up client
// You need to know $spreadsheetID (can be seen in the URL)
$sheetService = new Google_Service_Sheets($client);
$spreadSheet = $sheetService->spreadsheets->get($spreadsheetID);
$sheets = $spreadSheet->getSheets();
foreach($sheets as $sheet) {
$sheets[] = $sheet->properties->sheetId;
}
return $sheets;
}
?>
您的数据快照位于public void onDataChange(DataSnapshot dataSnapshot) {
EditText Name = (EditText) rootView.findViewById(R.id.Name);
ImageView profilePic = (ImageView)rootView.findViewById(R.id.profilePic);
for(DataSnapshot postSnapshot: dataSnapshot.getChildren()){
String image = postSnapshot.child("Image").getValue().toString();
Picasso.get().load(image).into(profilePic);
}
}
,因此您无需循环,因为public void onDataChange(DataSnapshot dataSnapshot) {
EditText Name = (EditText) rootView.findViewById(R.id.Name);
ImageView profilePic = (ImageView)rootView.findViewById(R.id.profilePic);
String image = dataSnapshot.child("Image").getValue().toString();
Picasso.get().load(image).into(profilePic);
}
是该快照的直接子项。