当前位置: 首页>>代码示例>>Java>>正文


Java Firebase.setAndroidContext方法代码示例

本文整理汇总了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);
}
 
开发者ID:C-Pro,项目名称:Chilim,代码行数:24,代码来源:MainActivity.java

示例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();


    }
 
开发者ID:JamesNikolaidis,项目名称:Thesis_Farmers_Helper,代码行数:23,代码来源:Database_Class_Functions.java

示例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);

}
 
开发者ID:agarwal-akash,项目名称:BonAppetit_Android-Project,代码行数:21,代码来源:MapsActivity.java

示例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();
        }
    });

}
 
开发者ID:WenhaoWu,项目名称:Morsi,代码行数:25,代码来源:Activity_Register.java

示例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);
}
 
开发者ID:StephenVanSon,项目名称:TutorMe,代码行数:18,代码来源:TutorActivity.java

示例6: onCreate

import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();
        Firebase.setAndroidContext(this);


        initGoogleAnalytics();
//        initGoogleTagManager();
    }
 
开发者ID:mangoblogger,项目名称:MangoBloggerAndroidApp,代码行数:10,代码来源:MangoBlogger.java

示例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());
    }

}
 
开发者ID:noisie74,项目名称:SportsNewsHistoryRecords,代码行数:11,代码来源:SportsLeagues.java

示例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);
}
 
开发者ID:blessingoraz,项目名称:Akwukwo,代码行数:35,代码来源:LoginActivity.java

示例9: onCreate

import com.firebase.client.Firebase; //导入方法依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    /* Initialize Firebase */
    Firebase.setAndroidContext(this);
}
 
开发者ID:kyleparker,项目名称:io16experiment-master,代码行数:8,代码来源:BaseApplication.java

示例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;
}
 
开发者ID:silva96,项目名称:guessthehashtag,代码行数:32,代码来源:WeeklyFragment.java

示例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);

}
 
开发者ID:harshbhardwajcsit,项目名称:CROM-box,代码行数:12,代码来源:MainActivity.java

示例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);
}
 
开发者ID:thorsteinson,项目名称:porcelain,代码行数:38,代码来源:MainActivity.java

示例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);
}
 
开发者ID:trigor74,项目名称:travelers-diary,代码行数:13,代码来源:Application.java

示例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) {

        }
    });
}
 
开发者ID:siddhantvinchurkar,项目名称:Marv,代码行数:41,代码来源:NotificationService.java

示例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();

    }
 
开发者ID:sahilshekhawat,项目名称:Pocket-Hacker-News,代码行数:28,代码来源:PostDetailFragment.java


注:本文中的com.firebase.client.Firebase.setAndroidContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。