我希望菜单中的标题会因点击的片段名称而改变.我得到的代码是,每个片段中的实际标题是"Home",它不会改变.但我发现,当我点击菜单中的一个项目时,标题会改变一秒并返回"主页"标题.我实施了拉杆机,但我仍然不知道是什么原因造成的.
我的代码:
package com.example.matant.gpsportclient;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.ProgressDialog;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import com.example.matant.gpsportclient.Controllers.Fragments.CreateEventFragmentController;
import com.example.matant.gpsportclient.Controllers.DBcontroller;
import com.example.matant.gpsportclient.Controllers.Fragments.GoogleMapFragmentController;
import com.example.matant.gpsportclient.Controllers.Fragments.ManageEventFragmentController;
import com.example.matant.gpsportclient.Controllers.Fragments.ProfileFragmentController;
import com.example.matant.gpsportclient.InterfacesAndConstants.AsyncResponse;
import com.example.matant.gpsportclient.InterfacesAndConstants.Constants;
import com.example.matant.gpsportclient.Utilities.DrawerItem;
import com.example.matant.gpsportclient.Utilities.DrawerItemCustomAdapter;
import com.example.matant.gpsportclient.Utilities.SessionManager;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.List;
public class MainScreen extends AppCompatActivity implements AsyncResponse {
private String[] mNavigationDrawerItemTitles;
private DrawerLayout mDrawerLayout;
private ListView …Run Code Online (Sandbox Code Playgroud) 我是Google Api位置的新手.我实现了一个处理所有位置回调的类.现在它在位置服务开启时工作.但如果关闭我创建了一个函数LocationAlertDialog(),它应该处理此错误.我不明白的问题我应该在我的代码中给她打电话,因为我不知道我在哪里检查GPS或网络提供商是否可用.
这是我的代码:
public class LocationTool implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
private Fragment frag;
private GoogleApiClient mGoogleApiClient;
private LocationRequest mLocationRequest;
private Location mLastLocation;
private boolean mRequestingLocationUpdates;
public OnLocationChangedListener delegate= null;
public LocationTool (Fragment frag, OnLocationChangedListener onLocationChangedListener)
{
mRequestingLocationUpdates = true;
delegate = onLocationChangedListener;
this.frag = frag;
buildGoogleApiClientAndCreateLocationRequest();
}
public boolean ismRequestingLocationUpdates() {
return mRequestingLocationUpdates;
}
public LocationRequest getmLocationRequest() {
return mLocationRequest;
}
public GoogleApiClient getmGoogleApiClient() {
return mGoogleApiClient;
}
public Location getmLastLocation() {
return mLastLocation;
}
public void setmLastLocation(Location mLastLocation) {
this.mLastLocation …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用基于imap协议的java mail api连接到我的邮箱.我检查并确定我插入了正确的参数.这是我得到的以下异常:
[警告]请通过您的网络浏览器登录:https://support.google.com/mail/accounts/answer/78754(失败)
我不知道为什么会发生这种情况我在我的Gmail帐户设置中启用了imap选项.
我是我的代码:
Properties protocol = new Properties();
protocol.setProperty("mail.store.protocol", "imaps");
try{
Session session = Session.getInstance(protocol, null);
Store store = session.getStore();
String host = prop.getProperty("host");
String email = prop.getProperty("username");
String password = prop.getProperty("password");
store.connect(host, email, password);
Folder inbox = store.getFolder("INBOX");
inbox.open(Folder.READ_ONLY);
int messageCount = inbox.getMessageCount();
model.addAttribute("msg","number of mails"+" "+messageCount);
Message[] messages = inbox.getMessages();
PrintWriter writer = new PrintWriter(username+".txt", "UTF-8");
for(int i=0;i<messageCount || prop.getProperty("status").equals(status.RUNNING.toString()) ;i++ ){
model.addAttribute("msg","Reading Mails");
Multipart mp = (Multipart) messages[i].getContent();
BodyPart bp …Run Code Online (Sandbox Code Playgroud) 我是 PowerShell 的初学者,我的主要困难是我有以下脚本,我想从 URL 的输出创建一个日志文件。现在脚本正在运行,但我不知道如何将浏览器输出保存到文件中。只有在未创建文件的情况下,我才需要将输出写入新文件。我尝试了 |Out-File 方法,但没有任何反应。
我的脚本:
start "http://myurl"
Start-Sleep -s 5
get-process iexplore | stop-process
get-process powershell | stop-process
Run Code Online (Sandbox Code Playgroud)
这是我的 php 代码:
<?php
/**
* Created by PhpStorm.
* User: matant
* Date: 11/17/2015
* Time: 1:46 PM
*/
define ('mysql_host','host');
define ('mysql_user','user');
define ('mysql_password','password');
define ('myDB','DBname');
$dblink= mysqli_connect(mysql_host, mysql_user, mysql_password,myDB);
if (!$dblink)
{
$message = sprintf(
"Could not connect to local database: %s",
mysql_error()
);
trigger_error($message);
echo $message;
return;
}
else{
echo "connection success"."<br/>";
}
$c_date = …Run Code Online (Sandbox Code Playgroud)