2017-01-13 12 views
-2

Я добавил логин в свое приложение. Теперь моя начальная деятельность - это LoginActivity. Каждый раз, когда я заполнял свои учетные данные для входа в приложение, мое приложение рушится, когда я нажимаю кнопку входа. Это моя ошибка Вход в систему:После нажатия кнопки сбой приложения для приложения

01-13 15:49:23.752 3116-3408/? E/InputReader: QEEXO fs_classify_touch NULL, not calling FingerSense 
01-13 15:49:23.887 3116-3408/? E/InputReader: QEEXO fs_touch_up NULL, not calling FingerSense 
01-13 15:49:23.923 2475-2475/? E/HAL: load: id=gralloc != hmi->id=gralloc 
01-13 15:49:23.938 3116-3130/? E/ReportTools: This is not beta user build 
01-13 15:49:23.969 3116-3407/? E/InputDispatcher: channel '2f67413 com.example.hartl.main_pp/com.example.hartl.main_pp.LoginActivity (server)' ~ Channel is unrecoverably broken and will be disposed! 
01-13 15:49:23.974 3116-3126/? E/HsmCoreServiceImpl: onTransact in code is: 102 
01-13 15:49:24.005 4043-4187/? E/HwLauncher: SettingsEx , no such field. 
01-13 15:49:24.018 18188-18208/? E/TotemWeather: WidgetUtils getWidgetShowCityInfo return myLocation 
01-13 15:49:24.073 2475-2475/? E/HAL: load: id=gralloc != hmi->id=gralloc 
01-13 15:49:24.123 2475-2475/? E/HAL: load: id=gralloc != hmi->id=gralloc 
01-13 15:49:24.262 2475-2475/? E/hwcomposer: setGpuBoost:228: Can't open /sys/class/devfreq/gpufreq/max_freq: Permission denied 
01-13 15:49:24.605 2475-2475/? E/HAL: load: id=gralloc != hmi->id=gralloc 

Кто-нибудь знает решение? Благодаря

+0

разместить свой код, пожалуйста – firegloves

ответ

0

это мой MainActivity

общественного класса MainActivity расширяет AppCompatActivity реализует NavigationView.OnNavigationItemSelectedListener, OnMapReadyCallback { личное TextView txtName; частный TextView txtEmail; приватная кнопка btnLogout;

private SQLiteHandler db; 
private SessionManager session; 

private GoogleMap googleMap; 

SupportMapFragment sMapfragment; 

@Override 
protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.activity_main); 
    txtName = (TextView) findViewById(R.id.name); 
    txtEmail = (TextView) findViewById(R.id.email); 

    // SqLite database handler 
    db = new SQLiteHandler(getApplicationContext()); 

    // session manager 
    session = new SessionManager(getApplicationContext()); 


    // Fetching user details from sqlite 
    HashMap<String, String> user = db.getUserDetails(); 

    String name = user.get("name"); 
    String email = user.get("email"); 

    // Displaying the user details on the screen 
    txtName.setText(name); 
    txtEmail.setText(email); 

    // Logout button click event 



















    sMapfragment = SupportMapFragment.newInstance(); 

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

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); 
    navigationView.setNavigationItemSelectedListener(this); 
    sMapfragment.getMapAsync(this); 

    if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { 
     if (ActivityCompat.shouldShowRequestPermissionRationale((Activity) this, android.Manifest.permission.ACCESS_FINE_LOCATION)) { 
      AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); 
      alertBuilder.setCancelable(false); 
      alertBuilder.setTitle("Permission necessary"); 
      alertBuilder.setMessage("Fine Location is necessary"); 
      alertBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { 

       @TargetApi(Build.VERSION_CODES.JELLY_BEAN) 
       public void onClick(DialogInterface dialog, int which) { 
        ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 1234); 
       } 
      }); 

      AlertDialog alert = alertBuilder.create(); 
      alert.show(); 
     } else { 
      ActivityCompat.requestPermissions(MainActivity.this, new String[]{android.Manifest.permission.ACCESS_FINE_LOCATION}, 1234); 
     } 

    } 





} 





@Override 
public void onBackPressed() { 
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 
    if (drawer.isDrawerOpen(GravityCompat.START)) { 
     drawer.closeDrawer(GravityCompat.START); 
    } else { 
     super.onBackPressed(); 
    } 
} 


@Override 
public boolean onOptionsItemSelected(MenuItem item) { 

    int id = item.getItemId(); 


    return super.onOptionsItemSelected(item); 
} 

@SuppressWarnings("StatementWithEmptyBody") 
@Override 
public boolean onNavigationItemSelected(MenuItem item) { 
    android.support.v4.app.FragmentManager sFm = getSupportFragmentManager(); 
    int id = item.getItemId(); 

    if (sMapfragment.isAdded()) 
     sFm.beginTransaction().hide(sMapfragment).commit(); 
    if (id == R.id.nav_map) { 
     if (!sMapfragment.isAdded()) 

      sFm.beginTransaction().add(R.id.penats, sMapfragment).commit(); 
     else 
      sFm.beginTransaction().show(sMapfragment).commit(); 

    } else if (id == R.id.nav_locations) { 

    } else if (id == R.id.nav_events) { 

    } else if (id == R.id.nav_calendar) { 

    } else if (id == R.id.nav_chat) { 

    } else if (id == R.id.nav_ranking) { 

    } 
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); 
    drawer.closeDrawer(GravityCompat.START); 
    return true; 
} 

@SuppressWarnings("ResourceType") 
@Override 
public void onMapReady(GoogleMap googleMap) { 

    googleMap.setMyLocationEnabled(true); 
} 

}