本文整理汇总了Java中com.firebase.client.Firebase.setAndroidContext方法的典型用法代码示例。如果您正苦于以下问题:Java Firebase.setAndroidContext方法的具体用法?Java Firebase.setAndroidContext怎么用?Java Firebase.setAndroidContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.firebase.client.Firebase
的用法示例。
在下文中一共展示了Firebase.setAndroidContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mEditText = (EditText) findViewById(R.id.message);
listView = (ListView) findViewById(R.id.list);
username = getUsername();
Firebase.setAndroidContext(this);
rootRef = new Firebase("https://vivid-inferno-572.firebaseio.com");
mListAdapter = new FirebaseListAdapter<com.example.android.chilim.ChatMessage>(this, com.example.android.chilim.ChatMessage.class,
android.R.layout.two_line_list_item, rootRef) {
@Override
protected void populateView(View v, com.example.android.chilim.ChatMessage model, int position) {
((TextView)v.findViewById(android.R.id.text1)).setText(model.getName());
((TextView)v.findViewById(android.R.id.text2)).setText(model.getText());
}
};
listView.setAdapter(mListAdapter);
}
示例2: Database_Class_Functions
import com.firebase.client.Firebase; //导入方法依赖的package包/类
/*****************************************************\\
*
* Database_Class Constructor( On Private Mode )
*/
//******************************************************/
private Database_Class_Functions(Context context) {
Firebase.setAndroidContext(context);
mStocks = new Firebase("https://farmers-helper-44f7a.firebaseio.com/Stocks");
mProducts=new Firebase("https://farmers-helper-44f7a.firebaseio.com/Products/Weeds");
mProductsForFarmingShortList=new Firebase("https://farmers-helper-44f7a.firebaseio.com/Products/Farming/");
mCompany= new Firebase("https://farmers-helper-44f7a.firebaseio.com/Company");
mChat= new Firebase("https://farmers-helper-44f7a.firebaseio.com/Chat");
mDistributer= new Firebase("https://farmers-helper-44f7a.firebaseio.com/Distributers");
mCompanyObject = new Company();
mDistributerObject = new Distributer();
mDistributerList = new ArrayList<>();
MessageMaxCounter1=0;
mDistributerObject = new Distributer();
}
示例3: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
//preparing GoogleApiClient
mGoogleApiClient=new GoogleApiClient.Builder(this)
.addApi(Places.GEO_DATA_API)
.build();
mGoogleApiClient.connect();
//Yes! finally Firebase :P
Firebase.setAndroidContext(this);
mFirebase=new Firebase(FIREBASE_URL);
mFirebase.child(FIREBASE_ROOT_NODE).addChildEventListener(this);
}
示例4: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_activity_register);
Firebase.setAndroidContext(this);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
TV_emial=(EditText)findViewById(R.id.regi_email);
TV_password = (EditText)findViewById(R.id.regi_password);
TV_password2 = (EditText)findViewById(R.id.regi_password2);
TV_user = (EditText)findViewById(R.id.regi_userName);
btn_regi = (Button)findViewById(R.id.regi_btn);
btn_regi.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
attemptRegi();
}
});
}
示例5: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
Firebase.setAndroidContext(this);
firebase = new Firebase("https://brilliant-inferno-9747.firebaseio.com/web/data");
geofire = new GeoFire(firebase);
if(mGoogleApiClient == null){
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API)
.build();
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tutor);
}
示例6: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Firebase.setAndroidContext(this);
initGoogleAnalytics();
// initGoogleTagManager();
}
示例7: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Firebase.setAndroidContext(this);
if(BuildConfig.DEBUG) {
Timber.plant(new Timber.DebugTree());
}
}
示例8: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.activity_login_acitivity);
Firebase.setAndroidContext (this);
mUserLoginEmail = (EditText) findViewById (R.id.user_email_login);
mUserLoginPassword = (EditText) findViewById (R.id.user_password_login);
mUserLoginPassword.setOnKeyListener (new View.OnKeyListener () {
@Override
public boolean onKey (View v, int keyCode, KeyEvent event) {
if (event.getAction () == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
Utils.hideSoftKeyboard (LoginActivity.this);
return true;
default:
break;
}
}
return false;
}
});
pref = getSharedPreferences ("Email", Context.MODE_PRIVATE);
String emailFromSharedPref = pref.getString ("email", "");
mUserLoginEmail.setText (emailFromSharedPref);
}
示例9: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
/* Initialize Firebase */
Firebase.setAndroidContext(this);
}
示例10: onCreateView
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_weekly, container, false);
AnalyticsApplication application = (AnalyticsApplication) getActivity().getApplication();
mTracker = application.getDefaultTracker();
Firebase.setAndroidContext(getActivity());
mRootRef = new Firebase("https://guessthehashtag.firebaseio.com/data");
mRootRef.authWithCustomToken("91cvapZgSdVcjyvrepGKS2nSgDDFAiiDBLDl97Rx", new Firebase.AuthResultHandler() {
@Override
public void onAuthenticated(AuthData authData) {
}
@Override
public void onAuthenticationError(FirebaseError firebaseError) {
}
});
mUsersDataset = new ArrayList<>();
mRecyclerView = (RecyclerView) rootView.findViewById(R.id.week_recycler_view);
mLayoutManager = new LinearLayoutManager(getActivity());
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.setHasFixedSize(true);
RecyclerView.ItemDecoration itemDecoration = new
DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST);
mRecyclerView.addItemDecoration(itemDecoration);
mLoadingWrapper = (RelativeLayout) rootView.findViewById(R.id.week_loading_wrapper);
renderData();
return rootView;
}
示例11: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash2);
Firebase.setAndroidContext(this);
mFirebaseStorage = FirebaseStorage.getInstance();
mImageView = (ImageView) findViewById(R.id.imgView);
}
示例12: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sharedPref = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
// Firebase setup
Firebase.setAndroidContext(this);
// Maps
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
// Builds a new GoogleApiClient for dealing with everything
if(mGoogleApiClient == null) {
mGoogleApiClient =
new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(LocationServices.API) //use location
.build(); //build me the client already dammit!
mGoogleApiClient.connect();
}
//grabs varying data views
mtitleText = (TextView) findViewById(R.id.toiletTitle);
mdescriptionText = (TextView) findViewById(R.id.toiletDescription);
mShowDetailButton = (TextView) findViewById(R.id.seeMoreButton);
mShowIntruction = (TextView) findViewById(R.id.instruction);
//key for individual bathroom area
mToiletGuid = "";
mcleanStatus = (ImageView) findViewById(R.id.cleaninessImage);
}
示例13: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
Firebase.setAndroidContext(this);
// enable disk persistence
Firebase.getDefaultConfig().setPersistenceEnabled(true);
//pre-load fonts for rtEditor
FontManager.preLoadFonts(this);
}
示例14: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
final Context context=this;
Firebase.setAndroidContext(this);
firebase=new Firebase("https://marvelement.firebaseio.com/");
firebase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
if(((String)dataSnapshot.child("Notify").getValue()).equals("Yes")){
System.out.println("Push Notification Received!");
Intent intent = new Intent(context, MainActivity.class);
PendingIntent pIntent = PendingIntent.getActivity(context, 0, intent, 0);
Notification n = new Notification.Builder(context)
.setContentTitle((String) dataSnapshot.child("NotifyTitle").getValue())
.setContentText((String) dataSnapshot.child("NotifyContent").getValue())
.setSmallIcon(R.drawable.polymer)
.setContentIntent(pIntent)
.setAutoCancel(true)
.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.build();
NotificationManager notificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
notificationManager.notify(0, n);
Handler j=new Handler();
j.postDelayed(new Runnable() {
@Override
public void run() {
firebase.child("Notify").setValue("No");
}
},8500);
}
}
@Override
public void onCancelled(FirebaseError firebaseError) {
}
});
}
示例15: onCreate
import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Necessary to set Firebase context before using it.
Firebase.setAndroidContext(getContext());
if (getArguments().containsKey(ARG_ITEM_ID)) {
// Load the dummy content specified by the fragment
// arguments. In a real-world scenario, use a Loader
// to load content from a content provider.
mItem = Data.items.get(Long.parseLong(getArguments().getString(ARG_ITEM_ID)));
Activity activity = this.getActivity();
// CollapsingToolbarLayout appBarLayout = (CollapsingToolbarLayout) activity.findViewById(R.id.toolbar_layout);
// if (appBarLayout != null) {
// appBarLayout.setTitle("");
// }
}
firebase = new Firebase("https://hacker-news.firebaseio.com/v0/");
firebaseItems = firebase.child("item");
Log.d("mItem Kids size:", Integer.toString(mItem.kids.size()));
Data.comments.clear();
}