0
以下是我的mainActivity - 直到onCreate函數,沒有導入。我將其定義爲我父母的大部分活動。我希望我的應用在登錄活動中打開 - 用戶在使用應用之前將登錄。登錄後,我希望打開此活動。如何直接打開一個不是主要活動的活動,然後移動到主要活動的Android應用程序?
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
public final String APP_TAG = "MyCustomApp";
public final static int CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE = 1034;
public String photoFileName = "photo.jpg";
public final int MY_PERMISSIONS_REQUEST_CAMERA = 66;
public static final int MEDIA_TYPE_IMAGE = 1;
public static final int MEDIA_TYPE_VIDEO = 2;
private static final int CAMERA_REQUEST = 1888;
final int REQUEST_LOG_IN = 666;
FirebaseDatabase database = FirebaseDatabase.getInstance();
String m_Text;
User user = null;
DatabaseReference myRef;
DatabaseReference userRef;
@Override
protected void onCreate(Bundle savedInstanceState)
{
//default text
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
tryGetUser();
}
以下是我的LoginActivity - 直到onCreate函數,沒有導入。我想成爲第一個打開的頁面
public class LoginActivity extends BaseActivity implements LoaderCallbacks<Cursor> {
final int RC_SIGN_IN = 101;
final int REQUEST_LOG_IN = 666;
/**
* Id to identity READ_CONTACTS permission request.
*/
private static final int REQUEST_READ_CONTACTS = 0;
/**
* Keep track of the login task to ensure we can cancel it if requested.
*/
private UserLoginTask mAuthTask = null;
// UI references.
private AutoCompleteTextView mEmailView;
private EditText mPasswordView;
private View mProgressView;
private View mLoginFormView;
private FirebaseAuth mAuth;
private GoogleApiClient mGoogleApiClient;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
mAuth = FirebaseAuth.getInstance();
setContentView(R.layout.activity_login);
// Set up the login form.
mEmailView = (AutoCompleteTextView) findViewById(R.id.email);
populateAutoComplete();
mPasswordView = (EditText) findViewById(R.id.password);
mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
if (id == R.id.login || id == EditorInfo.IME_NULL) {
attemptLogin();
return true;
}
return false;
}
});
代碼是一個文本。請發佈您的代碼,而不是截圖 –
這是否更好?這是我在stackoverflow上的第一個問題,所以我仍然在研究如何提出問題,需要什麼信息來回答我的問題等。 – user7337642
好得多。謝謝 –