android studio lbs项目,android studio use 百度LBS have JNICommonMemCache
我已經在百度論壇說了,我就不復制過來了。。。
看了別人說,配置方式不一樣。在AS配置那些so要像NDK那樣配置 ?= =
上面是NDK配置
如果翻不了墻,就看我的把 = =
在最后,我上傳我的代碼 = =供大家學習
//Fragment類
package?pany.fragment;
import?android.os.Bundle;
import?com.baidu.mapapi.map.SupportMapFragment;
public?class?ExploreFragment?extends?SupportMapFragment?{
private?static?final?String?ARG_SECTION_TITLE?=?"section_title";
/**
*?返回根據title參數創建的fragment
*/
public?static?SupportMapFragment?newInstance(String?title,?com.baidu.mapapi.map.BaiduMapOptions?baiduMapOptions)?{
SupportMapFragment?supportMapFragment?=?newInstance(baiduMapOptions);
Bundle?args?=?new?Bundle();
args.putString(ARG_SECTION_TITLE,?title);
supportMapFragment.setArguments(args);
return?supportMapFragment;
}
}
//MainAcitivity的關鍵代碼
==================================================================
fragments?=?new?ArrayList();
MapStatus?ms?=?new?MapStatus.Builder().overlook(-20).zoom(15).build();
BaiduMapOptions?bo?=?new?BaiduMapOptions().mapStatus(ms)
.compassEnabled(false).zoomControlsEnabled(false);
fragments.add(ExploreFragment.newInstance("發現",?bo));
======================================================================
String[]?itemTitle?=?getResources().getStringArray(R.array.item_title);
FragmentManager?fragmentManager?=?getSupportFragmentManager();
FragmentTransaction?ft?=?fragmentManager.beginTransaction();
currentFragment?=?fragmentManager.findFragmentByTag(title);
for?(int?i?=?0;?i?
if?(itemTitle[i].equals(title))?{
if?(currentFragment?==?null)?{
currentFragment?=?fragments.get(i);
ft.add(R.id.container,?currentFragment,?title);
}
if?(lastFragment?!=?null)?{
ft.hide(lastFragment);
}
if?(currentFragment.isDetached())?{
ft.attach(currentFragment);
}
ft.show(currentFragment);
lastFragment?=?currentFragment;
mit();
onSectionAttached(title);
}
}
package?mon.constant;
import?android.app.Application;
import?android.content.Context;
import?android.content.SharedPreferences;
import?android.content.res.Configuration;
import?android.preference.PreferenceManager;
import?android.support.v4.content.LocalBroadcastManager;
import?android.util.Log;
import?android.widget.Toast;
import?com.baidu.mapapi.SDKInitializer;
/**
*?Created?by?moziqi?on?2015/1/29?0029.
*/
public?class?GenericApplication?extends?Application?{
private?final?static?String?TAG?=?"GenericApplication";
private?static?GenericApplication?instance;
public?static?GenericApplication?getInstance()?{
return?instance;
}
@Override
public?void?onCreate()?{
super.onCreate();
SDKInitializer.initialize(this);
instance?=?this;
}
@Override
public?void?onLowMemory()?{
super.onLowMemory();
showLog("系統處于匱乏狀態");
}
@Override
public?void?onTrimMemory(int?level)?{
super.onTrimMemory(level);
}
@Override
public?void?onConfigurationChanged(Configuration?newConfig)?{
super.onConfigurationChanged(newConfig);
}
/**
*?打印土司
*
*?@param?msg
*/
public?static?void?showToast(String?msg)?{
Toast.makeText(instance,?msg,?Toast.LENGTH_LONG).show();
}
/**
*?打印日志
*
*?@param?msg
*/
public?static?void?showLog(String?msg)?{
showLog(TAG,?msg);
}
public?static?void?showLog(String?tag,?String?msg)?{
Log.e(tag,?msg);
}
/**
*?獲取局部廣播器
*
*?@return
*/
public?static?LocalBroadcastManager?getLocalBroadcastManager()?{
LocalBroadcastManager?instance1?=?LocalBroadcastManager.getInstance(instance);
return?instance1;
}
public?SharedPreferences?sharePreference(String?name,?int?mode)?{
SharedPreferences?sharedPreferences?=?getSharedPreferences(name,?mode);
return?sharedPreferences;
}
private?SharedPreferences.Editor?userEditor()?{
SharedPreferences?user?=?sharePreference("user",?Context.MODE_PRIVATE);
SharedPreferences.Editor?edit?=?user.edit();
return?edit;
}
public?void?saveNewUserInfo(String?username,?String?password)?{
SharedPreferences.Editor?edit?=?userEditor();
edit.putString("username",?username);
edit.putString("password",?password);
mit();
}
public?void?deleteCurrentUserInfo()?{
SharedPreferences.Editor?edit?=?userEditor();
edit.remove("username");
edit.remove("password");
mit();
}
}
總結
以上是生活随笔為你收集整理的android studio lbs项目,android studio use 百度LBS have JNICommonMemCache的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 谷歌更新 Google Photos 应
- 下一篇: AMD 发布拖延已久的 Radeon R