我正在为Android开发谷歌地图应用程序.
但是,不知怎的,我的应用程序崩溃给出了如下错误:
java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.
Run Code Online (Sandbox Code Playgroud)
这是我的AndroidManifest.xml的样子: -
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.locations"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-feature
android:glEsVersion="0x00020000"
android:required="true"/>
<permission android:name ="com.example.locations.permission.MAPS_RECEIVE" android:protectionLevel="signature"></permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.locations.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyAZhJllASbTnrFta8hj55shKydSi0ks824"/>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
日志: -
01-09 12:29:35.249: E/AndroidRuntime(7448): Caused by: java.lang.IllegalStateException: A required …Run Code Online (Sandbox Code Playgroud) I have a array:-
private string[][] barValues = new string[][] { new string[]{ "1.9", "5.8", "4.8", "Since Inception", "24-Jan 2014 to 24 Jun 2014" },
new string[]{"1.2", "16.5","9.8", "Year to date","01-Apr 2014 to 24-Jun 2014" },
new string[]{"11.6","28.8","23.5","Last quarter","01-Jan to 24-Jun 2014"} };
Run Code Online (Sandbox Code Playgroud)
I want to convert this array into my custom list :-
List<Portfolio> list = new List<Portfolio>();
Run Code Online (Sandbox Code Playgroud)
I tried doing :-
List<Portfolio> list=myArray.Cast<Portfolio>().ToList();
Run Code Online (Sandbox Code Playgroud)
But I get a error:-
System.InvalidCastException: Cannot cast from source type to destination type.
How …
我有一个ArrayList,它有一些元素.重复此列表中的项目.我想将类似的值分组并将其转换为数组.
目前我的ArrayList是: -
ArrayList<String> isonC = new ArrayList<String>();
Run Code Online (Sandbox Code Playgroud)
isonC =`[a,a,a,a,b,c,c,C,c,c,c,d,d,d,d,d,d,d]的值I组合如下: -
icons = isonC.toArray(new String[isonC.size()]);
icons = new HashSet<String>(Arrays.asList(icons)).toArray(new String[0]);
Run Code Online (Sandbox Code Playgroud)
我得到的值为: - icons = [a, c, b,d]
而元素的实际顺序应为: -
[a,b, c,d]
Run Code Online (Sandbox Code Playgroud)
为什么第二和第三个值互换了?
任何建议都会有所帮助.谢谢
我在片段中有以下构造函数:-
public PlaceDialogFragment(Place place, DisplayMetrics dm){
super();
this.mPlace = place;
this.mMetrics = dm;
}
Run Code Online (Sandbox Code Playgroud)
我也试过这个:-
public static final DialogFragment newInstance(Place place, DisplayMetrics dm)
{
DialogFragment fragment = new DialogFragment();
Bundle bundle = new Bundle(2);
bundle.putParcelable("Place", place);
bundle.putLong("Metrics", dm);
fragment.setArguments(bundle);
return fragment ;
}
Run Code Online (Sandbox Code Playgroud)
但是bundle.putLong("Metrics", dm) 网上有错误
这Place是一个实现 Parceable 接口的类
但我收到一条错误消息:-
Avoid non-default constructors in fragments: use a default constructor plus Fragment#setArguments(Bundle) instead
Run Code Online (Sandbox Code Playgroud)
任何建议如何解决这个问题?