the query would be that I would not know how to use it well, since I'm guiding myself by what the tutorials say and in SO (in English) but I have not managed to make it work I have the following information:
content_locales.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/imgLogoLocal"
android:layout_width="match_parent"
android:layout_height="200dp"
android:contentDescription="@string/logo_local" />
<fragment
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="220dp"
class="com.reservamos.MapFragment"/>
<Button
android:id="@+id/btnReservar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/solicitar_reserva" />
</LinearLayout>
LocalActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
final Context context = getContext();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_locales);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(true);
imagenlocal = (ImageView)findViewById(R.id.imgLogoLocal);
android.support.v4.app.Fragment fragment = new android.support.v4.app.Fragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.mapview, fragment);
transaction.commit();
int id;
id = getIntent().getIntExtra("id",0);
Servicio ser = new Servicio();
Locales local = new Locales();
try {
local = ser.GetLocal(context, id);
} catch (JSONException e) {
e.printStackTrace();
}
toolbar.setTitle(local.getNombre());
if (imagenlocal != null){
byte[] decodeString = new byte[0];
try {
decodeString = Base64.decode(local.getImagen(), Base64.NO_OPTIONS);
} catch (IOException e) {
e.printStackTrace();
}
Bitmap decodebitmap = BitmapFactory.decodeByteArray(decodeString,
0, decodeString.length);
imagenlocal.setImageBitmap(decodebitmap);
}
}
and the map
MapFragment.java and fragment_map.xml
taken from link
I do not place the classes because I do not modify any of the classes belonging to the tutorial
The problem is that when I enter to show me the map, I logged the following
05-11 01: 00: 55.262 10220-10242 / com.reservamos I / art: Background partial concurrent mark sweep GC freed 682293 (16MB) AllocSpace objects, 100 (1600KB) objects, 23% free, 51MB / 67MB , paused 61,646ms total 448.110ms
05-11 01: 00: 56.074 10220-10242 / com.reservamos I / art: Background sticky concurrent mark sweep GC freed 671925 (16MB) AllocSpace objects, 94 (1504KB) objects, 20% free, 53MB / 67MB , paused 89.349ms total 359.503ms
05-11 01: 00: 56.921 10220-10242 / com.reservamos I / art: Background partial concurrent mark sweep GC freed 707530 (16MB) AllocSpace objects, 94 (1504KB) Objects, 22% free, 56MB / 72MB , paused 66.386ms total 467.650ms
and continue with a similar log, until I kill the application directly.
Is there something I will be doing wrong?
Before you ask me, yes, I have the api key enabled to try and the permissions are as follows:
<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-permission android:name="android.permission.INTERNET" />
<permission
android:name="com.example.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-permission android:name="com.example.permission.MAPS_RECEIVE"/>
any contribution they make is appreciated
Start of the log, where apparently the error could be
05-12 00: 21: 23.256 25931-25936 / com.reservamos I / art: Compiler allocated 4MB to compile void android.widget.TextView. (android.content.Context, android.util.AttributeSet, int, int) 05-12 00: 21: 43.932 25931-25936 / com.reservamos I / art: Do full code cache collection, code = 126KB, data = 109KB 05-12 00: 21: 43.933 25931-25936 / com.reservamos I / art: After code cache collection, code = 120KB, data = 87KB 05-12 00: 21: 44.075 25931-25936 / com.reservamos I / art: Do partial code cache collection, code = 121KB, data = 97KB 05-12 00: 21: 44.078 25931-25936 / com.reservamos I / art: After code cache collection, code = 118KB, data = 95KB Increasing code cache capacity to 512KB
fragment in which the error could be, since it is referencing something that is not an error, but as an informative message
05-12 00: 21: 20.047 25931-25931 / com.reservamos W / System: ClassLoader referenced unknown path: /data/app/com.reservamos-2/lib/arm 05-12 00: 21: 20.187 25931-25931 / com.reservamos W / art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter (android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff $ Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
Then, follow the first item that you put on the Garbage Collector