I am new to android development.
I have added some controls in main.xml but they fail to show up on the emulator.
Please tell me what am I doing wrong.
Here is my xml;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:gravity="center">
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center" android:text="#string/app_name"
android:textSize="30dp"/>
<EditText android:id="#+id/editable"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android.Text="Text goes here " android:layout_weight="1" android:hint="#string/display"/>
<Button android:id="#+id/button"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="#string/mainPageButton"
android:textSize="25dp"/>
</LinearLayout>
Do you have:
setContentView(R.layout.main);
in your onCreate method in your activity?
Related
On debug everything works fine. But if I create a releasebuild the Flutter http-libary doesn't work.
I've the internet-permission in my androidmanifest.
Currently I use Flutter 2.5.0 and http 0.13.3.
I've already created a new project, but it doesn't work there either.
<application
android:name="io.flutter.app.FlutterApplication"
android:usesCleartextTraffic="true"
android:networkSecurityConfig="#xml/network_security_config"
android:label="Appname"
android:icon="#mipmap/ic_launcher">
................
</application>
Then inside res folder, create xml folder and add network_security_config.xml
Inside network_security_config.xml file, you may enter specific http url and you may use local api also.
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">example.uz</domain>
<domain includeSubdomains="true">example2.uz</domain>
<domain includeSubdomains="true">10.112.52.30</domain>
<domain includeSubdomains="true">192.168.12.81</domain>
</domain-config>
</network-security-config>
My card view elevation stopped working and showing shadow after I updated my android studio 3.3 and migrating my project to androidx artifacts.
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="#dimen/card_margin"
app:cardCornerRadius="#dimen/card_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Other Code-->
</LinearLayout>
</androidx.cardview.widget.CardView>
Add app:cardElevation="10dp" property to cardview.
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="#dimen/card_margin"
**app:cardElevation="#dimen/card_margin"**
app:cardCornerRadius="#dimen/card_margin">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--Other Code-->
</LinearLayout>
</androidx.cardview.widget.CardView>
you need to specify app:cardUseCompatPadding="true" in your CardView then set app:cardElevation="4dp" with approbate value
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:elevation="12dp"
app:cardCornerRadius="12dp"
app:cardUseCompatPadding="true"
app:cardElevation="4dp">
I have tried the messaging app from quickstart-unity-master and it was working fine on it's own but when I have added the Facebook plugin the following happened:
The firebase FCM is initializing successfully but I am no longer receiving the OnMessageReceived and OnTokenReceived.
It has probably something to do with the com.google.firebase.MessagingUnityPlayerActivity activity not receiving the events, but I am not sure what is wrong since the Android manifest is still the same after adding facebook.
I am using facebook 7.10.1
Here is my android manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="${applicationId}" android:versionCode="1" android:versionName="1.0">
<application android:label="#string/app_name" android:icon="#drawable/app_icon">
<!-- The MessagingUnityPlayerActivity is a class that extends
UnityPlayerActivity to work around a known issue when receiving
notification data payloads in the background. -->
<activity android:name="com.google.firebase.MessagingUnityPlayerActivity" android:label="#string/app_name" android:icon="#drawable/app_icon" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
</activity>
<service android:name="com.google.firebase.messaging.MessageForwardingService" android:exported="false" />
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="#android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
<activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
<activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
<activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
<activity android:name="com.facebook.unity.AppInviteDialogActivity" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb11111111111111" />
<provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider233093877143960" android:exported="true" />
</application>
</manifest>
appreciate your help
the issue was some missing dependencies, at first i only included what is needed by both SDK and tried them separately and they worked, but together didn't work for some reason;
the solution was to switch the build system from internal to gradle , then you don't have to worry about the max DEX methods and you can let the google play resolver download all the needed JAR and AAR;
i´ve been searching and testing a lot of code, but i can´t get map show in my app.
I have my api key writed in manifest and in the layout of my activity for google maps, but
i only can see map screen without any map, only google logo and grill, i can zoom in and out but no any map view and no zoom buttons, what is the reason?
In LogCat log i only see one error:
E/MapActivity(1024): Couldn't get connection factory client
W/System.err(1024): IOException processing: 26
W/System.err(1024): java.io.IOException: Server returned: 3
W/System.err(1024):at android_maps_conflict_avoidance.com.google.googlenav.map.BaseTileRequest.readResponseData(BaseTileRequest.java:115)
Here ismy code.
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.emapps.alarmmap"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="10"
android:targetSdkVersion="19" />
<permission
android:name="com.emapps.alarmmap.permission.MAPS_RECEIVE"
android:protectionLevel="signature" />
<permission
android:name="com.emapps.alarmmap.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.emapps.alarmmap.permission.C2D_MESSAGE" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.emapps.alarmmap.permission.MAPS_RECEIVE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCES_NETWORK_STATE" />
<uses-feature
android:glEsVersion="0x00020000"
android:required="true" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppBaseTheme" >
<activity
android:name="com.emapps.alarmmap.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="AIzaSyBxdPiMVTg5_XgRAitoQ5XGyFL8sBTS79A" />
</activity>
<uses-library
android:name="com.google.android.maps" />
<activity
android:name=".MapsView"
android:label="#string/title_activity_maps_view" >
</activity>
</application>
</manifest>
Layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.google.android.maps.MapView
android:id="#+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:enabled="true"
android:clickable="true"
android:apiKey="AIzaSyBxdPiMVTg5_XgRAitoQ5XGyFL8sBTS79A"/>
</LinearLayout>
And Activity.java:
package com.emapps.alarmmap;
import android.os.Bundle;
import com.google.android.maps.MapActivity;
public class MapsView extends MapActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
}
#Override
protected boolean isRouteDisplayed() {
return false;
}
}
I know that this capture is from API V1,im using APi V2,it is only for reference of my problem.
http://img513.imageshack.us/img513/4061/5ay7.jpg
I have tried on AVD and Phones with same result.
Sorry for my english and thanks in advance!
You are mixing deprecated Google Maps Android API v1 with new API v2. Remove all you code and start by following this: https://developers.google.com/maps/documentation/android/start
I am quite new to Android programming and am attempting to create an app, but I wanted to make sure that I have everything correct and error free before I do. I have the following errors in my manifest file: missing name attribute in element ....and tag permission missing required attribute name. I thought I did have a name in permission ("#string/app_name") but the error is still there! here is a copy of the code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="s.p.cunningham.checkyournumberslotteryapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="8" />
<permission android:name="#string/app_name"></permission>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="s.p.cunningham.checkyournumberslotteryapp.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>
</application>
Delete the whole tag. It is not a requirement in most of the cases, but god know's why comes as default when you create a new android application project.
If it isn't required, you can delete that tag... if you want to add any permission, then , delete that and use
<uses-permission
android:name="your permission....."
/>