Id
int64 21.6M
75.6M
| PostTypeId
int64 1
1
| AcceptedAnswerId
int64 21.6M
75.2M
⌀ | ParentId
int64 | Score
int64 -14
71
| ViewCount
int64 5
87.5k
| Body
stringlengths 1
26.6k
| Title
stringlengths 20
150
| ContentLicense
stringclasses 2
values | FavoriteCount
int64 0
0
⌀ | CreationDate
stringlengths 23
23
| LastActivityDate
stringlengths 23
23
| LastEditDate
stringlengths 23
23
⌀ | LastEditorUserId
int64 -1
21.3M
⌀ | OwnerUserId
int64 127k
21.3M
⌀ | Tags
sequencelengths 1
5
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63,016,241 | 1 | 63,018,140 | null | 0 | 2,123 | I would like to create my own QR Code, Print it and whenever I want to scan it with my flutter app, it should redirect me to a screen of the app.
Is this possible?
| Flutter. Scan QR Code, redirect to Screen | CC BY-SA 4.0 | 0 | 2020-07-21T14:01:33.657 | 2021-10-25T10:12:52.687 | null | null | 11,461,005 | [
"ios",
"flutter",
"camera",
"qr-code",
"mobile-development"
] |
63,032,690 | 1 | 63,037,290 | null | 0 | 124 | Looking for advice on my data structure in Firebase.
My app: Plant care reminders
I'm thinking the basic data structure can look something like this.
[](https://i.stack.imgur.com/XXlPF.png)
So the user can have many plants, and for each plant it can have many tasks.
I believe I would have a collection of users top level in Firestore, then each userData document would have a sub-collection of plants. Subsequently each plant would have a sub-collection of tasks.
The app will display all the users plants on one screen, that user can then click on a plant and view the tasks.
---
I would like the ability for the user to go offline for a period and still be able to access everything.
Is it wise to do one big query to retrieve all the data on the app load up? Doing this to make sure if they do go offline Firestore has all their cached sub-collections.
Or is it better to do a query on load up to get the users sub-collection of plants so they can see what they have, then when they click on a plant do another query to get that plants sub-collection of tasks?
If a user can see a plant, then goes offline and clicks that plant. Is it possible to query the plants sub-collection of tasks without network connection?
---
Apologies for poor explanation, trying to wrap my head round offline data persistence with Firestore and nested sub-collections when Firestore does shallow queries.
| Offline access to Firestore sub-collections | CC BY-SA 4.0 | null | 2020-07-22T11:01:38.180 | 2020-07-22T15:00:28.843 | null | null | 6,639,134 | [
"firebase",
"flutter",
"google-cloud-firestore",
"mobile-development"
] |
63,115,639 | 1 | null | null | 0 | 391 | I have a problem in recording a call I have made a service to get the call state. In TelephonyManager.EXTRA_STATE_OFFHOOK when the call is received. I am using following code to record the call
```
rec = new MediaRecorder();
rec.setAudioSource(MediaRecorder.AudioSource.MIC);
rec.setOutputFormat(MediaRecorder.OutputFormat.AAC_ADTS);
rec.setOutputFile(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + sdf + "rec.aac");
rec.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
TelephonyManager manager = (TelephonyManager) getApplicationContext().getSystemService(getApplicationContext().TELEPHONY_SERVICE);
manager.listen(new PhoneStateListener() {
@Override
public void onCallStateChanged(int state, String incomingNumber) {
super.onCallStateChanged(state, incomingNumber);
System.out.println("incomingNumber : " + incomingNumber);
System.out.println("state : " + state);
if (TelephonyManager.CALL_STATE_IDLE == state && rec == null) {
rec.stop();
rec.reset();
rec.release();
recordstarted = false;
} else if (TelephonyManager.CALL_STATE_OFFHOOK == state) {
try {
rec.prepare();
rec.start();
recordstarted = true;
} catch (IOException e) {
e.printStackTrace();
}
}
}
}, PhoneStateListener.LISTEN_CALL_STATE);
return START_STICKY;
}
```
with the permissions
```
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ANSWER_PHONE_CALLS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```
This code is working fine and creates the audio file but when I listen the audio file I can only listen my outgoing voice, caller voice is not recorded.
When I Use
`recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);`
Instead of
`recorder.setAudioSource(MediaRecorder.AudioSource.MIC);`
in above code, It throws an Exception
java.lang.RuntimeException: start failed at android.media.MediaRecorder.start(Native Method)
also Tried but it works same as .
also not supported.
| Call Recording using VOICE_CALL AudioSource is not working in Android Pie Version | CC BY-SA 4.0 | null | 2020-07-27T12:45:37.843 | 2020-07-27T12:45:37.843 | null | null | 9,355,081 | [
"android",
"android-studio",
"mobile-development"
] |
63,284,513 | 1 | null | null | 0 | 426 | Currently there is a screen with the following schema:
```
<ScrollView>
<Header>
<FlatList> // virtualized
<Header>
<FlatList> // virtualized
<Header>
<FlatList> // virtualized
...
</ScrollView>
```
is just a header-alike stylized text.
It naturally gives a warning:
> VirtualizedLists should never be nested inside plain ScrollViews with
the same orientation - use another VirtualizedList-backed container
instead.
There is a nice-working solution for a single list:
> [React-Native another VirtualizedList-backed container](https://stackoverflow.com/questions/58243680/react-native-another-virtualizedlist-backed-container)
But how to deal with multiple lists like in the schema above?
| Multiple VirtualizedLists and ScrollViews warning | CC BY-SA 4.0 | null | 2020-08-06T13:19:50.643 | 2020-08-06T13:19:50.643 | null | null | 1,065,145 | [
"react-native",
"react-native-flatlist",
"mobile-development",
"react-native-scrollview"
] |
63,303,115 | 1 | 63,333,187 | null | 3 | 735 | I have a xamarin app where I need to read from a json file I have added in the Asset folder.
[This is how the folder tree is in the solution explorer.](https://i.stack.imgur.com/YmtsG.png)
The code being used to read this json file is called from the User class in the Model folder.
This is how I have tried to access this file.
```
string path = Path.Combine(Directory.GetCurrentDirectory(), "..", "Assets", "data", "User.json");
var assembly = typeof(User).GetType().Assembly;
var stream = assembly.GetManifestResourceStream($"{assembly.GetName().Name}.{"User.json"}");
using (var reader = new StreamReader(stream))
{
string jsonString = await reader.ReadToEndAsync();
users = JsonConvert.DeserializeObject<List<User>>(jsonString);
}
```
The stream variable is null.
Please help out.
| How to Read Json/Text Files from Asset Folder in Xamarin | CC BY-SA 4.0 | null | 2020-08-07T13:44:54.743 | 2020-08-10T18:19:46.910 | 2020-08-10T18:19:46.910 | 229,897 | 14,057,695 | [
"c#",
"xamarin",
"mobile-development"
] |
63,351,112 | 1 | null | null | 2 | 146 | Not sure if this is the right spot for this but I haven't been able to find anything useful online so any advice would be appreciated. Basically I'm working on a android facial recognition app that use firebase ml to detect faces and tensorflow to recognize faces. That all works fine but when I register a user I don't know how to store it on a server so that the face can be checked while on other devices or save the face to the original device so it doesn't need to be re-registered when the app is closed.
Ive looked for a while online and surprisingly couldn't find anything related to this. I have an idea in my head about a possible solution of saving a bitmap of the picture and then storing it locally and remotely on a SQL database but ideally if people with experience or a better understanding of this area could point me in the right direction that would be great!
This is my first project in the ML world and I am working off of this repository I found on github repository - [https://github.com/estebanuri/face_recognition](https://github.com/estebanuri/face_recognition) .
Its late here so I will answer any and all questions in the morning!
| How to store recognized faces so that they can be used when the app is closed and on different devices | CC BY-SA 4.0 | null | 2020-08-11T03:35:43.700 | 2020-08-11T07:47:36.717 | 2020-08-11T07:47:36.717 | 404,970 | 14,083,835 | [
"java",
"android",
"face-recognition",
"mobile-development"
] |
63,373,770 | 1 | null | null | 0 | 412 | I'm creating first react-native dependency for both android and iOS. I have done coding part for android but now I'm stuck in iOS. Where to write code for my library and how to test.
| Create own dependency in react native for iOS | CC BY-SA 4.0 | null | 2020-08-12T09:34:26.483 | 2020-08-12T10:11:13.037 | null | null | 7,537,695 | [
"ios",
"react-native",
"mobile-development",
"react-native-native-module"
] |
63,442,304 | 1 | 63,442,351 | null | 0 | 955 | I want to make a webview application. The first page has a login section. On the second page, the course scores are written. I want to receive notifications as the scores are announced. How can I do that ?
| Webview flutter for education notification | CC BY-SA 4.0 | null | 2020-08-16T21:56:08.607 | 2020-08-16T23:04:14.523 | null | null | 13,253,818 | [
"android",
"ios",
"flutter",
"webview",
"mobile-development"
] |
63,464,111 | 1 | 63,574,278 | null | 0 | 341 | I have a signup form and I am trying to make it show the successful SnackBar message first before it navigates to the login page. when I add it to my if statement, it just pushes the login screen without showing any of the Snackbar messages
```
onPressed: () {
if (_formKey.currentState.validate()) {
Scaffold.of(context).showSnackBar(SnackBar(
content: Text('processing data'),
));
User user = User(
fullName: fullName.text,
phoneNumber: phoneNumber.text,
password: password.text,
);
final database = DatabaseProvider.db;
database.insert(user);
Scaffold.of(context).showSnackBar(SnackBar(
content: Text('registration successful'),
));
Navigator.popAndPushNamed(context, Routes.home);
}
_formKey.currentState.save();
},
```
| Load SnackBar before navigating to login page | CC BY-SA 4.0 | null | 2020-08-18T07:51:50.137 | 2020-08-25T07:48:32.633 | null | null | 12,933,821 | [
"flutter",
"mobile-development",
"flutter-navigation",
"flutter-form-builder"
] |
63,650,621 | 1 | null | null | 2 | 594 | I have created my website using Java Enterprise Edition (JSP/Servlets) and MySql 8 for my database. It is a typical CRUD application with a feature that let the user track the car's location.
I thought of using Flutter since it will save me time with its cross-platform capabilities but I have'nt found any documentations that will make the user login from the app to my website and fetch some data.
I'm pretty sure it is possible somehow. Otherwise is there a way to simulate my website as fast as possible without using Chrome obviously.
| How to connect my Flutter App to my Java WebApp? | CC BY-SA 4.0 | null | 2020-08-29T18:45:15.173 | 2020-08-29T21:21:31.100 | 2020-08-29T21:21:31.100 | 9,209,825 | 11,531,369 | [
"java",
"mysql",
"flutter",
"servlets",
"mobile-development"
] |
63,670,942 | 1 | null | null | 0 | 66 | I do everything according to the lessons on YouTube, but I can't open the application. How do I fix the error? I tried to install different versions of android on the virtual device, but nothing helped. I don't understand what I did wrong. Tried doing a little code check by commenting. If Oncreate is commented out, an empty activity is opened.
Here is MainActivity.java
```
package com.makar_mikhalchenko.itchat;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.firebase.ui.auth.AuthUI;
import com.firebase.ui.database.FirebaseListAdapter;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.database.FirebaseDatabase;
import android.text.format.DateFormat;
import java.util.Objects;
public class MainActivity extends AppCompatActivity {
private static int SIGN_IN_CODE = 1;
private RelativeLayout activity_main;
private FirebaseListAdapter<Message> adapter;
private FloatingActionButton sendBtn;
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(requestCode == SIGN_IN_CODE){
if (resultCode == RESULT_OK){
Snackbar.make(activity_main, "Вы авторизованы", Snackbar.LENGTH_LONG).show();
displayAllMessages();
}else{
Snackbar.make(activity_main, "Вы не авторизованы", Snackbar.LENGTH_LONG).show();
finish();
}
}
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
activity_main = findViewById(R.id.activity_main);
sendBtn = findViewById(R.id.btnSend);
sendBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText textField = findViewById(R.id.messageField);
if (textField.getText().toString() == "")
return;
FirebaseDatabase.getInstance().getReference().push().setValue(
new Message(FirebaseAuth.getInstance().getCurrentUser().getEmail(), textField.getText().toString()));
textField.setText("");
}
});
//пользователь ещё не авторизован
if (FirebaseAuth.getInstance().getCurrentUser() == null)
startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().build(), SIGN_IN_CODE);
else {
Snackbar.make(activity_main, "Вы авторизованы", Snackbar.LENGTH_LONG).show();
displayAllMessages();
}
}
private void displayAllMessages() {
ListView listOfMessages = findViewById(R.id.list_of_messages);
adapter = new FirebaseListAdapter<Message>(this, Message.class, R.layout.list_item, FirebaseDatabase.getInstance().getReference()) {
@Override
protected void populateView(View v, Message model, int position) {
TextView mess_user, mess_time, mess_text;
mess_user = v.findViewById(R.id.message_user);
mess_time = v.findViewById(R.id.message_time);
mess_text = v.findViewById(R.id.message_text);
mess_user.setText(model.getUserName());
mess_text.setText(model.getTextMessage());
mess_time.setText(DateFormat.format("dd-mm-yy HH:mm:ss", model.getMessageTime()));
}
};
listOfMessages.setAdapter(adapter);
}
}
```
Here activity_main.xml
```
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:id="@+id/activity_main">
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:src="@drawable/ic_send_button"
android:tint="@android:color/white"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="5sp"
android:layout_marginBottom="5sp"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/text_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/btnSend">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/messageField"
android:hint="Введите сообщение"
/>
</com.google.android.material.textfield.TextInputLayout>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/text_layout"
android:id="@+id/list_of_messages"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:divider="@android:color/transparent"
android:dividerHeight="16dp"
android:layout_marginBottom="12dp"
>
</ListView>
</RelativeLayout>
```
Debug issues
```
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.makar_mikhalchenko.itchat, PID: 8987
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/Api$zzf;
at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source)
at com.firebase.ui.auth.util.CredentialsAPI.initGoogleApiClient(CredentialsAPI.java:145)
at com.firebase.ui.auth.util.CredentialsAPI.<init>(CredentialsAPI.java:65)
at com.firebase.ui.auth.ui.ChooseAccountActivity.onCreate(ChooseAccountActivity.java:91)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.api.Api$zzf" on path: DexPathList[[zip file "/data/app/com.makar_mikhalchenko.itchat-1/base.apk"],nativeLibraryDirectories=[/data/app/com.makar_mikhalchenko.itchat-1/lib/x86, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at com.google.android.gms.auth.api.Auth.<clinit>(Unknown Source)
at com.firebase.ui.auth.util.CredentialsAPI.initGoogleApiClient(CredentialsAPI.java:145)
at com.firebase.ui.auth.util.CredentialsAPI.<init>(CredentialsAPI.java:65)
at com.firebase.ui.auth.ui.ChooseAccountActivity.onCreate(ChooseAccountActivity.java:91)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I/FA: Tag Manager is not found and thus will not be used
D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_screen_class(_sc)=MainActivity, firebase_screen_id(_si)=-2868454111777039973}]
V/FA: Connection attempt already in progress
V/FA: Connection attempt already in progress
Activity resumed, time: 2583628
V/FA: Screen exposed for less than 1000 ms. Event not sent. time: 444
V/FA: Connection attempt already in progress
Activity paused, time: 2583641
```
Build.gradle
```
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.makar_mikhalchenko.itchat"
minSdkVersion 24
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.android.material:material:1.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation 'com.google.firebase:firebase-database:19.4.0'
implementation 'com.firebaseui:firebase-ui:0.6.2'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
}
//apply plugin: 'com.google.gms.google-services'
```
| When you try to start the application, it closes | CC BY-SA 4.0 | null | 2020-08-31T12:35:50.377 | 2020-08-31T13:11:05.400 | 2020-08-31T13:11:05.400 | 14,196,410 | 14,196,410 | [
"java",
"android",
"android-studio",
"mobile",
"mobile-development"
] |
63,691,298 | 1 | 63,710,291 | null | 0 | 720 | I am new to react native and i am want to create a form. I am using formik for that. I also added react-native-dropdown-picker as the picker of react-native is having issues with placeholder on android. I want to pass my gender property that i am using in the dropdown into the state. Is there any way i can do that?
```
import React, {Component} from 'react'
import { StyleSheet, Button, TextInput, View, } from 'react-native'
import { Formik } from 'formik';
import DropDownPicker from 'react-native-dropdown-picker';
export default class Registration extends Component{
render() {
return (
<View>
<Formik
initialValues={{ fullName: '', mobileNumber: '', country: '', gender: '', password: '', email: '' }}
onSubmit={(values) => {
console.log(values)
}}
>
{(props) => (
<View>
<TextInput style={styles.input}
placeholder="Full Name"
onChangeText={props.handleChange('fullName')}
value={props.values.fullName}
>
</TextInput>
<TextInput style={styles.input}
placeholder="Mobile Number"
keyboardType="numeric"
onChangeText={props.handleChange('mobileNumber')}
value={props.values.mobileNumber}
>
</TextInput>
<TextInput style={styles.input}
placeholder="Country"
onChangeText={props.handleChange('country')}
value={props.values.country}
>
</TextInput>
<DropDownPicker
items={[
{label: 'Male', value: 'male'},
{label: 'Female', value: 'female'},
]}
defaultValue={props.values.gender}
placeholder="Select your gender"
containerStyle={{height: 40}}
style={{backgroundColor: '#fafafa'}}
itemStyle={{
justifyContent: 'flex-start'
}}
dropDownStyle={{backgroundColor: '#fafafa'}}
onChangeItem={item => props.setState({
gender: item.value
})}
/>
<TextInput style={styles.input}
placeholder="Email"
onChangeText={props.handleChange('email')}
value={props.values.email}
>
</TextInput>
<TextInput style={styles.input}
placeholder="Password"
secureTextEntry={true}
onChangeText={props.handleChange('password')}
value={props.values.password}
>
</TextInput>
<Button title="Submit" color="blue" onPress={props.handleSubmit}></Button>
</View>
)}
</Formik>
</View>
)
}
}
const styles = StyleSheet.create({
input: {
borderWidth: 1,
borderColor: "#ddd",
padding: 10,
fontSize: 18,
borderRadius: 6
}
})
```
| Is there a way i can pass my gender in the formik state? | CC BY-SA 4.0 | 0 | 2020-09-01T15:58:36.417 | 2021-11-30T18:14:51.740 | null | null | 5,870,900 | [
"javascript",
"react-native",
"formik",
"mobile-development",
"react-state"
] |
63,699,525 | 1 | null | null | 0 | 3,012 | I have been able to follow a few tutorials on Flutter about basic UI design, and am new to API calls. I think I need to convert types after making the API call, but I have no idea how.
Note: I know this is a lot of code in one file, but I will separate the API call file and custom class file from my main file
```
import 'dart:async';
import 'dart:convert';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
Future<Country> fetchAlbum() async {
final response = await http.get('https://restcountries.eu/rest/v2/all');
if (response.statusCode == 200) {
// If the server did return a 200 OK response,
// then parse the JSON.
return Country.fromJson(json.decode(response.body));
} else {
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load album');
}
}
class Country {
final String name;
final List<String> topLevelDomain;
final String alpha2Code;
final String alpha3Code;
final String callingCodes;
final String capital;
final String region;
final String subregion;
final int population;
final List<int> latlng;
final String demonym;
final int area;
final int gini;
final List<String> timezones;
final List<String> borders;
final String nativeName;
final int numericCode;
final List<String> currencies;
final List<String> translations;
final String flag;
final String cioc;
Country({
@required this.name,
@required this.topLevelDomain,
@required this.alpha2Code,
@required this.alpha3Code,
@required this.callingCodes,
@required this.capital,
@required this.region,
@required this.subregion,
@required this.population,
@required this.latlng,
@required this.demonym,
@required this.area,
@required this.gini,
@required this.timezones,
@required this.borders,
@required this.nativeName,
@required this.numericCode,
@required this.currencies,
@required this.translations,
@required this.flag,
@required this.cioc,
});
factory Country.fromJson(Map<String, dynamic> json) {
return Country(
name: json['name'],
topLevelDomain: json['topLevelDomain'],
alpha2Code: json['alpha2Code'],
alpha3Code: json['alpha3Code'],
callingCodes: json['callingCodes'],
capital: json['capital'],
region: json['region'],
subregion: json['subregion'],
population: json['population'],
latlng: json['latlng'],
demonym: json['demonym'],
area: json['area'],
gini: json['gini'],
timezones: json['timezones'],
borders: json['borders'],
nativeName: json['nativeName'],
numericCode: json['numericCode'],
currencies: json['currencies'],
translations: json['translations'],
flag: json['flag'],
cioc: json['cioc'],
);
}
}
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
Future<Country> futureAlbum;
@override
void initState() {
super.initState();
futureAlbum = fetchAlbum();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fetch Data Example',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
appBar: AppBar(
title: Text('Fetch Data Example'),
),
body: Center(
child: FutureBuilder<Country>(
future: futureAlbum,
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text(snapshot.data.name);
} else if (snapshot.hasError) {
return Text("${snapshot.error}");
}
// By default, show a loading spinner.
return CircularProgressIndicator();
},
),
),
),
);
}
}
```
Here is what my emulator screen looks like: [http://i1.imgrr.com/18Z/7512_Screenshot1599026660.png](http://i1.imgrr.com/18Z/7512_Screenshot1599026660.png)
| type List<dynamic> is not a subtype of Map<String,dynamic> | CC BY-SA 4.0 | null | 2020-09-02T06:00:33.873 | 2020-09-02T09:02:24.893 | 2020-09-02T06:09:12.133 | 14,167,872 | 14,167,872 | [
"android",
"flutter",
"dart",
"mobile-development"
] |
63,712,985 | 1 | 63,714,454 | null | 2 | 422 | What I want is simply a vertically dismissible widget. Android equivalent of what I want is [Slidr](https://github.com/r0adkll/Slidr)
and I've been searching for its equivalent in Flutter but I haven't managed to find it.
This if what I want to do;
[](https://gifyu.com/image/gcyb)
Any idea on how I can achieve this?
| Vertically Dismissable Screen Implementation on Flutter | CC BY-SA 4.0 | 0 | 2020-09-02T20:17:58.627 | 2020-09-02T22:45:32.713 | null | null | 11,858,000 | [
"android",
"flutter",
"dart",
"mobile-development",
"flutter-widget"
] |
63,743,224 | 1 | null | null | 1 | 2,622 | I'm trying to make a media query to fix the body on 1440px only for large monitor screens, and to do this, I have this code:
```
@media (min-width:1440px) {
body {
max-width:1440px
}
}
```
This media query works fine, but I need to limit it for a specific size of screen, like 23 inches, for example. I don't want to lose width on laptop screens.
I tried to make this using `max-resolution` but nothing seems to work.
So, can I create a media query that apply only with specific physical size of screen?
Thanks!
| Media query for 1440px width but not laptop screens? | CC BY-SA 4.0 | null | 2020-09-04T14:36:04.200 | 2020-09-04T14:50:59.327 | 2020-09-04T14:38:07.903 | 13,428,196 | 13,428,196 | [
"css",
"media-queries",
"screen-resolution",
"mobile-development"
] |
63,862,130 | 1 | null | null | 0 | 995 | I created a flutter android application based on , the problem is that it can't open .
| Open a new tab link in the same flutter webview | CC BY-SA 4.0 | null | 2020-09-12T15:49:51.900 | 2020-09-12T16:01:36.080 | 2020-09-12T16:01:36.080 | 9,209,825 | 10,193,358 | [
"android",
"flutter",
"webview",
"hyperlink",
"mobile-development"
] |
63,882,059 | 1 | null | null | 0 | 104 | I am still learning flutter and i encountered a problem. I have 2 screens one of them is ProductList and another one is ProductAdd. Problem is when user clicks on add button program navigates to ProductAdd. User enters some info and click OK. ProductAdd does some sqflite job and calls the navigate.pop() but the state doesnt change after user returns to homepage it changes when i reload the page.
Here is the productlist.(productCount is the one i want to update when navigate.pop get called)
```
ListView buildProductList() {
return ListView.builder(
itemCount: productCount,
itemBuilder: (BuildContext context,int position){
return Card(
color: Colors.cyan,
elevation: 2.0,
child: ListTile(
leading: CircleAvatar(backgroundColor: Colors.black12,child: Text("p"),),
title: Text(this.products[position].name),
subtitle: Text(this.products[position].description),
onTap: (){},
),
);
});
}
void gotoProductAdd() async {
var result = await Navigator.push(context,MaterialPageRoute(builder: (context)=>ProductAdd()));
getProducts();
}
void getProducts() async{
var productsFuture = dbHelper.getProducts();
//data is the data coming from sqflite db
productsFuture.then((data){
this.products = data;
productCount = data.length;
});
}
```
}
Here is the ProductAdd(where navigator.pop() executed)
```
void addProduct() async{
var result = await
dbHelper.insert(Product(name:txtName.text,
description:txtDescription.text,
unitPrice:double.tryParse(txtUnitPrice.text)));
Navigator.pop(context,true);
```
}
| Cant Update State After navigator.pop() | CC BY-SA 4.0 | null | 2020-09-14T09:55:53.613 | 2020-09-14T09:55:53.613 | null | null | 13,517,384 | [
"android",
"flutter",
"native",
"mobile-development"
] |
63,946,201 | 1 | 63,947,784 | null | 4 | 1,121 | I have made a design in Figma that I wanted to rebuild using Flutter.
I'm having a hard time choosing the right fontsize in Flutter that corresponds to the fontsize I
used in Figma.
For example in Figma I chose fontsize 144 for a title and it looked alright, but when I chose this fontsize for that title in Flutter, it looks way to big. So how do these fontsizes from Figma and Flutter compare?
Thanks in advance!
| How does fontsize in Figma compare to Flutter? | CC BY-SA 4.0 | null | 2020-09-17T21:08:47.333 | 2020-09-18T00:30:34.637 | null | null | 10,437,800 | [
"flutter",
"mobile",
"mobile-development",
"figma"
] |
64,011,239 | 1 | null | null | 0 | 119 | I wanted to make my first two widget to pin in my DraggableScrollableSheet widget.
[](https://i.stack.imgur.com/lLIPO.jpg)
| How can I pin first two top most widget in DraggableScrollableSheet widget? | CC BY-SA 4.0 | null | 2020-09-22T13:52:00.017 | 2020-09-22T20:37:13.760 | 2020-09-22T16:08:39.120 | 7,630,779 | 11,908,262 | [
"android",
"flutter",
"mobile",
"flutter-layout",
"mobile-development"
] |
64,053,387 | 1 | null | null | 0 | 138 | I have an expo-React native project. The Project is getting build correctly and i am able to generate .apk and .ipa files for it.
But when I try to run the app in the iPhone simulator. I am getting the below error:-
```
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'NSBundle must contain the expected assets'
```
| Error while running Expo-ReactNative app in Iphone Simulator | CC BY-SA 4.0 | null | 2020-09-24T19:46:02.690 | 2021-02-11T08:29:52.827 | null | null | 5,339,816 | [
"react-native",
"expo",
"mobile-development"
] |
64,110,141 | 1 | null | null | 1 | 83 | I'm attempting to use Contentful CMS and iterate through the array of data so I can display it in groups of Title, Style & Description in horizontal tiles. I able to do it with hard coded array of data but I am unable to do it with this...
I've included my View, View Model & Model, as you'll see the model holds my API call, my View Model handles just my identifiable data, then my View handles my view itself.
```
// MARK: - View
struct BeerListView: View {
@ObservedObject var draftVM = BeerModel()
var body: some View {
VStack {
ForEach(draftVM.draftBeerArray.indices, id: \.self) { item in
VStack {
Text(item.title)
Text(item.style)
Text(item.description)
}
}
}
}
}
// MARK: - View Model
struct BeersData: Identifiable {
var id = UUID()
var title: String = ""
var style: String = ""
var description: String = ""
}
// MARK: - Model
private let client = Client(spaceId: "SPACEID", accessToken: "SUPERSECRETTOKEN")
func getArray(id: String, completion: @escaping ([Entry]) -> ()) {
let query = Query.where(contentTypeId: id)
client.fetchArray(of: Entry.self, matching: query) { result in
switch result {
case .success( let array):
DispatchQueue.main.async {
completion(array.items)
print(result)
}
case.failure(let error):
print(error)
}
}
}
class BeerModel: ObservableObject {
@Published var draftBeerArray: [BeersData] = beerArray
init() {
getArray(id: "beers") { (items) in
items.forEach { (items) in
self.draftBeerArray.append(BeersData (
title: items.fields["title"] as! String,
style: items.fields["style"] as! String,
description: items.fields["description"] as! String))
}
}
}
}
```
| ForEach through Indices SwiftUI | CC BY-SA 4.0 | null | 2020-09-28T21:54:42.477 | 2020-09-29T03:53:21.877 | null | null | 14,128,044 | [
"swiftui",
"contentful",
"mobile-development"
] |
64,118,382 | 1 | null | null | 1 | 232 | I am developing a web application which until now was targeted to desktop-browsers only.
The client interacts with a backend that requires a cookie of a specific domain (e.g. "my.app.com").
For development, I run both client and backend locally on my machine.
Until now, to make the client include the required cookie when sending http requests to the backend, I modified the hosts file to map "my.local.app.com" to localhost - it works well.
Now I want to debug my app on mobile browsers (Android and iPhone) - which are connected to the same wifi as the machine.
For that, I need the devices to map "my.local.app.com" to my machine address (again, so the client http requests to the local backend includes the requested cookie).
Ideas I have rejected:
- -
Any suggestions on how to achieve this?
Thanks.
| How to include cookies of custom domain in http requests from mobile browsers to a local server? | CC BY-SA 4.0 | 0 | 2020-09-29T11:09:32.823 | 2020-09-29T11:09:32.823 | null | null | 8,596,351 | [
"android",
"mobile-development",
"iosdeployment"
] |
64,136,446 | 1 | 64,147,362 | null | -1 | 626 | I want to hide the top navigation bar as I showed in the below image.
![Image](https://i.stack.imgur.com/7nNl0.png)
| How to hide the top Navigation bar which is running based on Web Application | CC BY-SA 4.0 | null | 2020-09-30T11:17:45.340 | 2021-09-18T18:49:07.947 | 2021-09-18T18:49:07.947 | 924,109 | 7,795,484 | [
"javascript",
"python",
"web",
"progressive-web-apps",
"mobile-development"
] |
64,184,045 | 1 | null | null | 0 | 839 | I have manually uninstalled my on going development app on my Android phone via Visual Studio, but later when I'm trying to reinstall the app, I'm getting this error "Conflicting app signature."
But the app is already uninstalled and I couldn't find any file by searching it's name on my file explorer, I also tried to follow this one [Could not determine the installation package com.company.appName](https://stackoverflow.com/questions/54245275/could-not-determine-the-installation-package-com-company-appname), It worked with my emulator [face this problem in my emulator too] but not working with my physical phone (). I can't see any trace of my app.
My app is made with Xamarin.Forms
[](https://i.stack.imgur.com/lBFT2.png)
| How to uninstall an android app properly with it's signature? | CC BY-SA 4.0 | null | 2020-10-03T12:05:12.520 | 2020-10-03T12:32:25.803 | null | null | 6,662,984 | [
"android",
"xamarin.forms",
"uninstallation",
"android-keystore",
"mobile-development"
] |
64,349,977 | 1 | null | null | 2 | 1,526 | I am new in this language and I am working on a BMI(body mass index) app. As you see in the picture below:
![](https://i.stack.imgur.com/TX2nq.png)
I take the user input and calculate the result, and print out the result in console. For example:
```
I/flutter ( 4500): 2.25
I/flutter ( 4500): 20.0 // this is the result of BMI
I/flutter ( 4500): you are at your ideal weight. // this is the explanation
```
I want to show these results in a Text widget to let user see them. But I do not know how to do it. How can I take the value of the result from a function and add it to interface?
Here is my code, and in code I pointed out where did I stuck. Main function:
```
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'calculation.dart';
void main() => runApp(MyApp());
/// This is the main application widget.
class MyApp extends StatelessWidget {
static const String _title = 'BMI';
@override
Widget build(BuildContext context) {
return MaterialApp(
title: _title,
home: Scaffold(
appBar: AppBar(title: const Text(_title),
centerTitle: true,
backgroundColor: Colors.amber[900],
),
body: Center(
child: MyStatefulWidget(),
),
),
);
}
}
enum SingingCharacter { lafayette, jefferson }
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
MyStatefulWidget({Key key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
/// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
SingingCharacter _character = SingingCharacter.lafayette;
double height=1;
double weight=1;
String info1="";
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(10.0),
child:Scrollbar(
child:SingleChildScrollView(
child:Card(
color: Colors.amber[50],
child:Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.fromLTRB(0, 30, 10, 10),
child: Text("Sex:",
style:TextStyle(fontSize: 24, letterSpacing: 1.0)),
),
ListTile(
title: const Text('Female',
style:TextStyle(fontSize: 18, letterSpacing: 1.0)
),
leading: Radio(
activeColor: Colors.orange,
value: SingingCharacter.lafayette,
groupValue: _character,
onChanged: (SingingCharacter value) {
setState(() {
_character = value;
});
},
),
),
ListTile(
title: const Text('Male',
style:TextStyle(fontSize: 18, letterSpacing: 1.0,)
),
leading: Radio(
activeColor: Colors.orange,
value: SingingCharacter.jefferson,
groupValue: _character,
onChanged: (SingingCharacter value) {
setState(() {
_character = value;
});
},
),
),
SizedBox(height: 10.0),
Text("Your height:",
style:TextStyle(fontSize: 24, letterSpacing: 1.0)
),
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.fromLTRB(30, 0, 50, 10),
child: TextField(
decoration: new InputDecoration(labelText: "Your height(cm)"),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
], // Only numbers can be entered
onSubmitted: (input1){
if(double.parse(input1)>0){
setState(() => height=double.parse(input1));
print(input1);
}
},
),
),
SizedBox(height: 20),
Text("Your weight:",
style:TextStyle(fontSize: 24, letterSpacing: 1.0)
),
SizedBox(height: 10),
Padding(
padding: const EdgeInsets.fromLTRB(30, 0, 50, 10),
child: new TextField(
decoration: new InputDecoration(labelText: "Your weight(kg)"),
keyboardType: TextInputType.number,
inputFormatters: <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly
], // Only numbers can be entered
onSubmitted: (input2){
if (double.parse(input2)>0){
// print(weight);
setState(() {
return weight=double.parse(input2);
});
}
},
),),
SizedBox(height: 10,),
RaisedButton(
padding:EdgeInsets.fromLTRB(20, 5, 20, 5),
onPressed: () async{
await Calculation(height, weight);
// return Calculation.info1 ??? //i don't know how to take info1 from calculation function
},
color: Colors.amber[900],
child:Text(
'Calculate',
style:TextStyle(
color: Colors.white,
fontSize: 30,
letterSpacing: 2.0,
),
),
),
SizedBox(height: 20,),
Text('Results: $height,$weight'),
// Text('Calculation.info1'), // i do not know how to show info in a text box.
],
),
),
),
),
);
}
}
```
Calculation function;
```
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:math';
void Calculation(height,weight) {
double squarevalue = pow(height, 2);
double newsquare = squarevalue / 10000;
String info1="";
print(newsquare);
double value = weight / newsquare;
print(value);
// return value.toString();
if (value < 18.5) {
print("your weight is less than your ideal weight.");
// setState(() => info1="your weight is less than your ideal weight."); //i do not know how to set
// info1 to a new text
// return info1;
}
if (value > 25) {
if (value > 30) {
print("your weight is more than your ideal weight, your health is under risk.");
// info1="your weight is more than your ideal weight, your health is under risk.";
}
else {
print("your weight is more than your ideal weight.");
// info1="your weight is more than your ideal weight.";
}
}
else {
print("you are at your ideal weight.");
// info1="you are at your ideal weight.";
}
}
```
| How to put the result of a function into a Text widget in Flutter? | CC BY-SA 4.0 | null | 2020-10-14T09:04:44.500 | 2021-06-22T15:03:55.667 | 2021-06-22T14:26:56.423 | 13,023,928 | 14,421,322 | [
"function",
"android-studio",
"flutter",
"dart",
"mobile-development"
] |
64,372,325 | 1 | 64,375,138 | null | 0 | 450 | I have a string that is formatted like this:
ABC: title="EXAMPLE-TITLE", url="null", raw.length="28"
is there a way to always extract only the "title" field ?
I would not want to use substring.
Thanks
| Extract value from string in flutter(dart) | CC BY-SA 4.0 | null | 2020-10-15T13:11:40.327 | 2020-10-15T15:40:11.617 | 2020-10-15T14:41:43.497 | 14,380,149 | 14,380,149 | [
"string",
"flutter",
"dart",
"mobile-development"
] |
64,413,913 | 1 | 64,413,989 | null | 0 | 32 |
```
extension ArticlesVC: UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return models.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: CollectionTableViewCell.identifier, for: indexPath) as! CollectionTableViewCell
cell.configure(with: models)
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 200
}
}
struct Model {
let text: String
let imageName: String
init(text: String, imageName: String) {
self.text = text
self.imageName = imageName
}
}
```
```
class CollectionTableViewCell: UITableViewCell {
static let identifier = "CollectionTableViewCell"
var collectionView: UICollectionView?
var models = [Model]()
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
collectionView?.register(TopicsCollectionViewCell.self, forCellWithReuseIdentifier: TopicsCollectionViewCell.identifier)
collectionView?.delegate = self
collectionView?.dataSource = self
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
collectionView = UICollectionView(frame: .zero, collectionViewLayout: layout)
contentView.addSubview(collectionView!)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
collectionView?.frame = contentView.bounds
}
func configure(with models: [Model]) {
self.models = models
collectionView?.reloadData()
}
}
extension CollectionTableViewCell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return models.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: TopicsCollectionViewCell.identifier, for: indexPath) as! TopicsCollectionViewCell
cell.configure(with: models[indexPath.row])
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 250, height: 250)
}
}
```
**This TopicsCollectionViewCell **
```
class TopicsCollectionViewCell: UICollectionViewCell {
static let identifier = "TopicsCollectionViewCell"
let titleLabel: UILabel = {
let label = UILabel()
label.text = "label"
return label
}()
let photoImage: UIImageView = {
let imageView = UIImageView()
return imageView
}()
override init(frame: CGRect) {
super.init(frame: frame)
contentView.addSubview(titleLabel)
contentView.addSubview(photoImage)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layoutSubviews() {
super.layoutSubviews()
photoImage.frame = CGRect(x: 3,
y: 3,
width: contentView.width - 6,
height: 150)
titleLabel.frame = CGRect(x: 3,
y: photoImage.bottom + 5,
width: contentView.width - 6,
height: contentView.height - photoImage.height - 6)
}
public func configure(with model: Model) {
print(model)
self.titleLabel.text = model.text
self.photoImage.image = UIImage(named: model.imageName)
}
}
```
[This link is project with github](https://github.com/bilaldurnagol/NewsApp)
| Why doesn't go CollectionViewCell? | CC BY-SA 4.0 | null | 2020-10-18T13:29:34.767 | 2020-10-18T13:58:01.773 | null | null | null | [
"ios",
"swift",
"uicollectionview",
"uicollectionviewcell",
"mobile-development"
] |
64,422,207 | 1 | null | null | 0 | 157 | The space between my images on mobile is way too large: [mobile version](https://i.stack.imgur.com/w8V7p.png)
It looks okay on Dev Tools: [dev tools version](https://i.stack.imgur.com/LQreU.jpg)
HTML:
```
<div class="container-fluid">
<!-- <br> -->
<div class="row">
<img class="col-sm-6 col-md-4" src="digart/fire_cryinggirl.png" alt="girl crying underneath fire">
<img class="col-sm-6 col-md-4" src="digart/ko_munyeong.png" alt="chibi-style ko munyeong">
<!-- mindprison hidden on small-->
<img class="col-sm-6 col-md-4 d-sm-none d-md-block" src="digart/mind_prison.png" alt="brain in a prison">
</div>
</div>
```
CSS:
```
img {
object-fit: contain;
margin-bottom: 5vh;
}
```
I've already tried using a media query with max-width and decreasing the margin-bottom, but there is no change to the mobile version.
| Space between images on mobile is too large | CC BY-SA 4.0 | null | 2020-10-19T06:32:16.703 | 2020-10-19T07:51:40.720 | null | null | 14,476,146 | [
"html",
"css",
"mobile",
"bootstrap-4",
"mobile-development"
] |
64,433,454 | 1 | 64,433,547 | null | -1 | 49 |
# I have header to 1.section but I want to add 3.section. How can i do it?
```
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
view.sizeToFit()
view.backgroundColor = .clear
let titleLabel = UILabel(frame: CGRect(x: 0, y: 73, width: 250, height: 100))
titleLabel.backgroundColor = .clear
titleLabel.text = "Choose your \ntopics"
titleLabel.textAlignment = .left
titleLabel.numberOfLines = 0
titleLabel.font = UIFont(name: "SFCompactDisplay-Semibold", size: 38)
titleLabel.textColor = UIColor(red: 38/255, green: 50/255, blue: 91/255, alpha: 1)
view.addSubview(titleLabel)
return view
}
```
```
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch cells[section] {
case .collection:
return cells.count
case .view:
return 1
case .list:
return cells.count
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch cells[indexPath.row] {
case .collection:
let cell = tableView.dequeueReusableCell(withIdentifier: CollectionTableViewCell.identifier,
for: indexPath) as! CollectionTableViewCell
cell.configure(with: models)
return cell
case .view:
let cell = tableView.dequeueReusableCell(withIdentifier: FeaturedArticleTableViewCell.identifier,
for: indexPath) as! FeaturedArticleTableViewCell
cell.configure(with: models[indexPath.row])
return cell
case .list:
let cell = tableView.dequeueReusableCell(withIdentifier: ArticlesTableViewCell.identifier,
for: indexPath) as! ArticlesTableViewCell
return cell
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch cells[indexPath.row] {
case .collection:
return 67
case .view:
return 347
case .list:
return 130
}
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
return 194
}
```
[](https://i.stack.imgur.com/r5yVm.jpg)
| How do i add a header to 3.section? | CC BY-SA 4.0 | null | 2020-10-19T18:49:10.770 | 2020-10-19T19:13:24.573 | 2020-10-19T18:52:51.693 | 12,299,030 | null | [
"ios",
"swift",
"mobile",
"mobile-development"
] |
64,545,353 | 1 | null | null | 2 | 1,002 | I'm new to mobile development and I'm starting with Flutter to build a cross-platform app with a login process for Android and iOS. One of the app requirements is to keep the app session active and running permanently unless the user signs out or closes the app.
The API for the backend has a refresh token to keep the session open/alive, but the mobile OS keeps closing the app every few hours/days and restarting the login process.
How can I achieve this?
| Flutter - How to prevent an app from being closed by the mobile OS? | CC BY-SA 4.0 | null | 2020-10-26T21:39:55.300 | 2020-10-26T21:43:46.267 | null | null | 1,288,744 | [
"android",
"ios",
"flutter",
"session",
"mobile-development"
] |
64,572,596 | 1 | null | null | 0 | 82 | In my Xamarin.Forms app, I want to use a DependencyService for each platform to get meta data about local media files such as Height, Width and Rotation. Here is how I do it in Android:
```
public double ReturnVideoHeight(string mediaFilePath)
{
MediaMetadataRetriever reader = new MediaMetadataRetriever();
reader.SetDataSource(mediaFilePath);
var str = reader.ExtractMetadata(MetadataKey.VideoHeight);
if (double.TryParse(str, out double num))
{
return num;
}
return -1;
}
public double ReturnVideoWidth(string mediaFilePath)
{
MediaMetadataRetriever reader = new MediaMetadataRetriever();
reader.SetDataSource(mediaFilePath);
var str = reader.ExtractMetadata(MetadataKey.VideoWidth);
if (double.TryParse(str, out double num))
{
return num;
}
return -1;
}
public string ReturnVideoRotation(string mediaFilePath)
{
MediaMetadataRetriever reader = new MediaMetadataRetriever();
reader.SetDataSource(mediaFilePath);
return reader.ExtractMetadata(MetadataKey.VideoRotation);
}
```
I can't seem to find iOS libraries to accomplish the same thing. How could I go about this?
| Media Meta Data Retrieval in Xamarin.iOS | CC BY-SA 4.0 | null | 2020-10-28T12:11:31.743 | 2020-10-28T12:11:31.743 | null | null | 10,266,595 | [
"c#",
"xamarin",
"xamarin.ios",
"mobile-development"
] |
64,574,647 | 1 | null | null | 1 | 601 | I was following a tutorial on on Youtube about . It was doing well so far until the part. We used to show the images from the internet and for some reason it's not working for me. I commented the code and it worked; of course the images didn't show up so I'm sure that the code was the problem. Can anyone help me?
Here's the code:
```
Glide.with(context)
.asBitmap()
.load(contacts.get(position).getImgUrl())
.into(holder.image);
```
Here's what LOGCAT says:
```
2020-10-28 22:48:26.776 413-413/? E/netmgr: qemu_pipe_open_ns:62: Could not connect to the 'pipe:qemud:network' service: Invalid argument
2020-10-28 22:48:26.776 413-413/? E/netmgr: Failed to open QEMU pipe 'qemud:network': Invalid argument
2020-10-28 22:48:29.441 415-415/? E/wifi_forwarder: qemu_pipe_open_ns:62: Could not connect to the 'pipe:qemud:wififorward' service: Invalid argument
2020-10-28 22:48:29.441 415-415/? E/wifi_forwarder: RemoteConnection failed to initialize: RemoteConnection failed to open pipe
```
Some more errors:
```
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.recyclerviewexample, PID: 8594
java.lang.NullPointerException: Argument must not be null
at com.bumptech.glide.util.Preconditions.checkNotNull(Preconditions.java:29)
at com.bumptech.glide.util.Preconditions.checkNotNull(Preconditions.java:23)
at com.bumptech.glide.RequestBuilder.into(RequestBuilder.java:669)
at com.example.recyclerviewexample.ContactsRecViewAdapter.onBindViewHolder(ContactsRecViewAdapter.java:74)
at com.example.recyclerviewexample.ContactsRecViewAdapter.onBindViewHolder(ContactsRecViewAdapter.java:26)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7065)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7107)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6012)
at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6279)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6118)
at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6114)
at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2303)
at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1627)
at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1587)
at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:665)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4134)
at androidx.recyclerview.widget.RecyclerView.onMeasure(RecyclerView.java:3540)
at android.view.View.measure(View.java:25466)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:735)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:481)
at android.view.View.measure(View.java:25466)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:146)
at android.view.View.measure(View.java:25466)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:490)
at android.view.View.measure(View.java:25466)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at android.view.View.measure(View.java:25466)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1552)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:842)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:721)
at android.view.View.measure(View.java:25466)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6957)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:194)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:747)
at android.view.View.measure(View.java:25466)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:3397)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:2228)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2486)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1952)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8171)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972)
at android.view.Choreographer.doCallbacks(Choreographer.java:796)
at android.view.Choreographer.doFrame(Choreographer.java:731)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime: at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
```
Also here's the link to the video: [https://www.youtube.com/watch?v=fis26HvvDII&t=35923s](https://www.youtube.com/watch?v=fis26HvvDII&t=35923s) at 10:03:50
| How do I fix crashing Application when using Glide | CC BY-SA 4.0 | null | 2020-10-28T14:12:26.323 | 2020-10-28T15:17:03.373 | 2020-10-28T15:17:03.373 | 12,823,777 | 12,823,777 | [
"android",
"android-studio",
"android-glide",
"mobile-development"
] |
64,658,921 | 1 | null | null | 1 | 756 | I was trying to call a plain javascript function from an external file in react native but it is not running. Please suggest a way to inject a plain javascript function.
I have tried to use WebView:
```
<View style={{flex: 1}}>
<WebView ref={ref => { this.webview = ref; }}
source={{ html: HTML }}
injectedJavaScript={jsCode}
javaScriptEnabledAndroid={true}
javaScriptEnabled={true}
>
</WebView>
</View>
```
| how to write plain javascript external function in react native? | CC BY-SA 4.0 | null | 2020-11-03T08:06:19.410 | 2020-11-03T13:27:05.147 | 2020-11-03T11:44:46.443 | 5,872,733 | 14,568,831 | [
"javascript",
"react-native",
"mobile-development",
"wiris"
] |
64,661,122 | 1 | null | null | 1 | 53 | I need to use/import a JavaScript plugin in React-native.
Plugin file contains functions, written in javascript and not in es6 format. I need to use those in react-native either by Webview or can be other way.
I already tried WebView, But html code is not even loading JS plugin file (`<script type="text/javascript" src="./testjs.js">`)
Because when I give it a wrong path It should give me some file missing error, While Simple alert on same place is working.
here below is render on RN screen :-
```
render () {
var HTML = `<html> <head> <script type="text/javascript" src="./testjs.js"></script> </head> <body> <div id="workbookControl"></div> <div id="tableeditor" style="font-size : 50px;">I am written inside source HTML</div> </body> </html>`
var jsCode = ` true;`
return (
<WebView
originWhitelist={['*']}
source={{ html: HTML }}
injectedJavaScript={jsCode}
onMessage={() => {}}
javaScriptEnabledAndroid={true}
javaScriptEnabled={true}
/>
)
}
```
And here is code of testjs.js
```
(function hello(ddd) { alert("heiii"); return "Hello"; })(); true;
```
I want to call this hello() from testjs.js, How can I do that ?
| Ploblem facing in using javascript plugin in react-native | CC BY-SA 4.0 | null | 2020-11-03T10:34:47.620 | 2020-11-03T12:06:01.603 | 2020-11-03T12:06:01.603 | 14,569,075 | 14,569,075 | [
"javascript",
"react-native",
"mathjax",
"mobile-development",
"wiris"
] |
64,661,463 | 1 | 64,662,076 | null | -1 | 123 | I need to create component like
[](https://i.stack.imgur.com/CRJPt.png)
Here is part of my code
```
<ImageBackground source={{uri}} style={{width: 234, height: 165, marginTop: 10, borderRadius: 10}}>
<Text style={{margin: 10, fontSize: 24, fontWeight: 'bold', color: 'white'}}>
Test
</Text>
<Text style={{marginLeft: 7, marginTop: 80, color: 'white'}}>
<Icons name="distance" size={25} style={{color: 'white'}}></Icons>
<Text style={{color: 'white'}}>
2 KM
</Text>
<Text> </Text>
<Icons name="star" size={25} style={{color: 'white'}}></Icons>
<Text style={{color: 'white'}}>
4.9
</Text>
</Text>
</ImageBackground>
```
Prop style `borderRadius` doesn't works with component `ImageBackground`.
I tried to use various wrappers, but didn't get any results, also I tried to use `Image` component, but this component cannot contain other components (`Text` for ex.)
| Can't create rounded border with component "ImageBackground" | CC BY-SA 4.0 | null | 2020-11-03T10:55:25.353 | 2020-11-06T16:29:09.770 | 2020-11-06T16:29:09.770 | 3,157,428 | 11,845,406 | [
"react-native",
"user-interface",
"jsx",
"mobile-development"
] |
64,663,651 | 1 | null | null | 1 | 29 | I have finished v1 of my mobile app (in Flutter). It has been designed for the Android os and now I need to make changes so when run on an iPhone, it'll look more like an iOS app. The first thing I'd like to do is replace the hamburger side slide in menu (the drawer menu).
I've always been an Android user, so I don't have much knowledge of how iPhone apps look. But i think their main menu is like a toolbar at the bottom of the screen?
The following is Flutter code I have in all my screens to create the top header panel and the drawer menu:
```
@override
Widget build(BuildContext context) {
return WillPopScope(
child: Scaffold(
appBar: rmoAppBar(subText: 'My Jobs'),
drawer: RmoMenu(),
body: isLoading
? Center(child: CircularProgressIndicator())
: Column(
```
What should i do to make this more for iOS as far as the menu goes? And how? Thanks.
| Android v iOS user interface differences | CC BY-SA 4.0 | 0 | 2020-11-03T13:20:37.217 | 2020-11-03T13:20:37.217 | null | null | 13,247,321 | [
"flutter",
"user-interface",
"mobile-development"
] |
64,782,150 | 1 | null | null | 1 | 1,207 | I have installed both flutter and plugins on but when I run doctor, it shows that plugins are not installed
```
Doctor summary (to see all details, run flutter doctor -v):
[√]
Flutter (Channel stable, 1.22.3, on Microsoft Windows [Version 10.0.18363.1139], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.46.1)
[√] VS Code, 64-bit edition (version 1.51.0)
[√] Connected device (1 available)
! Doctor found issues in 1 category.
```
| Flutter plugins not installed | CC BY-SA 4.0 | null | 2020-11-11T07:26:26.670 | 2022-04-14T17:20:48.283 | 2020-11-11T07:59:11.293 | 1,189,800 | 12,994,051 | [
"android",
"android-studio",
"flutter",
"flutter-dependencies",
"mobile-development"
] |
64,866,419 | 1 | null | null | 0 | 87 | I am new to mobile development. I am developing a flutter application which has a web version. Users have memberships in that application. When ever a user cancels or activates a membership through web, I want that information to be updated in mobile application. What is the best way to achieve this?
I thought of making API call when profile page is visited, but other pages shall not updated based on memberships. Making an auto-refresh call can be done but won't that be an extra overhead?
Edit: Backend is a wordpress site and whole data for mobile app is done through API calls.
| Auto update flutter application with membership details | CC BY-SA 4.0 | null | 2020-11-16T22:06:14.450 | 2020-11-17T01:32:32.203 | 2020-11-17T01:32:32.203 | 8,678,471 | 8,678,471 | [
"flutter",
"mobile-development",
"flutter-http"
] |
64,966,710 | 1 | null | null | 0 | 133 | I'm relatively new to Angular/Native/Mobile dev. I need to figure out the element, after it has been rendered on the screen. I have been trying to find a solution online for a while now, with no result - maybe I'm searching for the wrong stuff? I really expected that would have already been implemented as part of Label/UILabel, I don't know, I'm lost. Any ideas would be greatly appreciated. Thanks!
| Android and iOS Label line count Angular/Nativescript | CC BY-SA 4.0 | null | 2020-11-23T10:35:19.073 | 2020-11-23T12:23:19.767 | null | null | 3,347,958 | [
"android",
"ios",
"label",
"angular2-nativescript",
"mobile-development"
] |
64,993,555 | 1 | null | null | 0 | 29 | i want to know how the app keeps intereacting with database even if the app is closed .
an application of any game , it let you play one game for 1 ticket .. and when there is no tickets left it will give you a ticket every 15 minuts , so the user closes the app and then comebacks after (let's say 5 hours) and he finds the tickets charged .
how this could be possible in android studio ?
| How to make an android application communicate with database even if the app is closed | CC BY-SA 4.0 | null | 2020-11-24T19:31:41.397 | 2020-11-24T19:34:53.610 | null | null | 13,406,465 | [
"database",
"android-studio",
"mobile-development",
"android-developer-api"
] |
65,047,535 | 1 | 65,047,820 | null | 0 | 95 | For example, I have already written some asynchronous function and want to call it on button click. Like this:
```
static async Task<string> ParseSth(string URL) { ... }
```
And I want to call it when I click this button:
```
FindViewById<Button>(Resource.Id.ButtonParse).Click += ...
```
In google or youtube I found material only about lamda expressions. So, how to do this?
| How to call an async non-lambda function on button in Xamarin.Android | CC BY-SA 4.0 | null | 2020-11-28T07:49:16.357 | 2020-11-28T08:36:40.630 | null | null | 14,708,487 | [
"c#",
".net",
"xamarin",
"mobile-development"
] |
65,094,124 | 1 | null | null | 0 | 356 | Im working on parsing this xml file on Flutter with Flutter xml package. I created model class like this but when I access to cList[index].. that returning null.
If I access `snapshot.data.tarih` in main.dart , its working. But Currency class variables returning null to me.
Where am I doing wrong? Thank you.
XML:
```
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="isokur.xsl"?>
<Tarih_Date Tarih="30.11.2020" Date="11/30/2020" Bulten_No="2020/227" >
<Currency CrossOrder="0" Kod="USD" CurrencyCode="USD">
<Unit>1</Unit>
<Isim>ABD DOLARI</Isim>
<CurrencyName>US DOLLAR</CurrencyName>
<ForexBuying>7.7892</ForexBuying>
<ForexSelling>7.8032</ForexSelling>
<BanknoteBuying>7.7837</BanknoteBuying>
<BanknoteSelling>7.8149</BanknoteSelling>
<CrossRateUSD/>
<CrossRateOther/>
</Currency>
<Currency CrossOrder="1" Kod="AUD" CurrencyCode="AUD">
<Unit>1</Unit>
<Isim>AVUSTRALYA DOLARI</Isim>
<CurrencyName>AUSTRALIAN DOLLAR</CurrencyName>
<ForexBuying>5.7366</ForexBuying>
<ForexSelling>5.7740</ForexSelling>
<BanknoteBuying>5.7102</BanknoteBuying>
<BanknoteSelling>5.8087</BanknoteSelling>
<CrossRateUSD>1.3546</CrossRateUSD>
<CrossRateOther/>
</Currency>
<Currency CrossOrder="2" Kod="DKK" CurrencyCode="DKK">
<Unit>1</Unit>
<Isim>DANİMARKA KRONU</Isim>
<CurrencyName>DANISH KRONE</CurrencyName>
```
rates.model.dart
```
import 'package:xml/xml.dart';
class TarihDate {
String tarih;
List<Currency> cList;
TarihDate._(this.tarih, this.cList);
factory TarihDate.fromElement(XmlElement xmlElement) {
return TarihDate._(
xmlElement.getAttribute("Tarih"),
xmlElement
.findElements("Currency")
.map((e) => Currency.fromElement(e))
.toList());
}
}
class Currency {
String currencyName;
String forexBuying;
String forexSelling;
String banknotBuying;
String banknotSelling;
Currency._(this.currencyName, this.forexBuying, this.forexSelling,
this.banknotBuying, this.banknotSelling);
factory Currency.fromElement(XmlElement genreElement) {
return Currency._(
genreElement.getAttribute('CurrencyName'),
genreElement.getAttribute('ForexBuying'),
genreElement.getAttribute('ForexSelling'),
genreElement.getAttribute('BanknotBuying'),
genreElement.getAttribute('BanknotSelling'));
}
}
```
rates.service.dart
```
import 'package:currency_rates/model/rates_model.dart';
import 'package:http/http.dart' as Http;
import 'package:xml/xml.dart' as xml;
String url = "https://www.tcmb.gov.tr/kurlar/today.xml";
Future<TarihDate> getJsonFromUrl() async {
var response = await Http.get(url);
var raw = xml.XmlDocument.parse(response.body);
var elements = raw.getElement("Tarih_Date");
return TarihDate.fromElement(elements);
}
```
main.dart
```
body: FutureBuilder(
future: getJsonFromUrl(),
builder: (context, AsyncSnapshot<TarihDate> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting)
return Center(child: CircularProgressIndicator());
if (snapshot.hasData) {
print(snapshot.data.cList[0].currencyName);
return ListView.builder(
itemBuilder: (context, index) {
return ListTile(
title: Text(
snapshot.data.cList[index].forexBuying,
style: TextStyle(color: Colors.black),
),
);
},
itemCount: snapshot.data.cList.length);
}
return ErrorWidget(throw Exception("Error"));
}),
```
| Why return null model class list for xml parsing in Flutter? | CC BY-SA 4.0 | null | 2020-12-01T16:06:31.750 | 2020-12-05T07:50:32.700 | null | null | 13,077,944 | [
"xml",
"flutter",
"dart",
"xml-parsing",
"mobile-development"
] |
65,247,249 | 1 | 65,247,721 | null | 0 | 260 | I want to know whether it is possible to load url in background?
overall i want to achieve is that to refresh some url in background using Java android.
| Is there a way to refresh android WebView in background service? | CC BY-SA 4.0 | null | 2020-12-11T07:21:13.043 | 2020-12-11T08:02:15.350 | null | null | 13,168,654 | [
"java",
"android",
"mobile-development"
] |
65,292,107 | 1 | null | null | 1 | 100 | I am working with sqflite database in flutter for the first time, but am unsure where I am going wrong. I call the db initialiser, but I don't get the output after it has happeneed (success message). Any help is greatly appreciated. Here is the code that I have written:
```
import 'package:path_provider/path_provider.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqflite/sqlite_api.dart';
import 'dart:io';
import 'package:path/path.dart';
final String tableName = 'notification';
final String columnKey = 'ColumnKey';
final String columnNumber = 'ColumnNumber';
class NotifInfo{
int number;
String key;
NotifInfo(
{
this.number,
this.key,
}
);
factory NotifInfo.fromMap(Map<String, dynamic> json) => NotifInfo(
number: json["number"],
key: json["key"]
);
Map<String, dynamic> toMap() =>{
"number": number,
"key": key,
};
}
class NotifHelper{
static Database _database;
static NotifHelper _notifHelper;
NotifHelper._createInstance();
factory NotifHelper(){
if (_notifHelper == null){
_notifHelper = NotifHelper._createInstance();
}
return _notifHelper;
}
Future<Database> get database async{
if (_database == null){
_database = await initialiseDatabase();
}
return _database;
}
static NotifHelper _notifhelper;
Future<Database> initialiseDatabase() async{
var dir = await getDatabasesPath();
var path = dir + "noti.db";
var database = await openDatabase(path, version: 1, onCreate: (db, version){
db.execute('''
CREATE TABLE $tableName ($columnKey STRING, $columnNumber INT)
''');
db.execute('''INSERT INTO $tableName ($columnKey, $columnNumber) VALUES ("PrimaryKey", 1)''');
});
return database;
}
void insertNotif(NotifInfo notifInfo) async{
var db = await this.database;
var result = db.insert(tableName, notifInfo.toMap());
print('result is: $result');
}
}
```
```
import 'dart:io';
import 'dart:ui';
import 'package:connectivity/connectivity.dart';
import 'package:data_connection_checker/data_connection_checker.dart';
import 'package:flutter/widgets.dart';
import 'package:http/http.dart' as http;
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'dart:convert';
import 'dart:async';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:pravproj/db/database_provider.dart';
import 'package:share/share.dart';
import 'articles_class/articles.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
//var value = gethttps();
class PravUI extends StatefulWidget {
@override
_PravUIState createState() => _PravUIState();
}
class _PravUIState extends State<PravUI> {
var data;
bool connectivity = true;
StreamSubscription<DataConnectionStatus> listener;
Timer timer;
int counter = 0;
NotifHelper _notifhelper = NotifHelper();
@override
void initState() {
// TODO: implement initState
super.initState();
_notifhelper.initialiseDatabase().then((value){
print("------------Database Initialised----------------");
});
data = getData();
timer = Timer.periodic(Duration(seconds: 15), (Timer t) => addValue(connectivity));
}
```
| db not initialising in sqflite - flutter | CC BY-SA 4.0 | null | 2020-12-14T15:55:10.650 | 2020-12-14T15:55:10.650 | null | null | 14,713,055 | [
"database",
"flutter",
"dart",
"mobile-development",
"sqflite"
] |
65,293,769 | 1 | 65,293,969 | null | 1 | 3,708 | I have a problem with the android xml file when creating the appBundle. However, I cannot find the problem, could anyone help me please? I have never removed anything from the file. I have never really worked with manifest files before, so I wasn't completely sure what I was looking for.
Thanks in advance
```
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="-----------------">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application
android:name=".Application"
android:label="Pravachaka Sabdam"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
</intent-filter>
</receiver>
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
<activity
android:name="io.flutter.embedding.android.FlutterActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:showWhenLocked="true"
android:turnScreenOn="true"
>
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter>
<action android:name="FLUTTER_NOTIFICATION_CLICK" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android: name="android.permission.INTERNET" android:maxSdkVersion="28" />
</manifest>
```
Error Message
```
Error parsing LocalFile: 'A:\Flutter\BETA TEST FOLDER\Android\one\android\app\src\main\AndroidManifest.xml' Please ensure that the android manifest is a valid XML document andtry again.
```
| Problem with android manifest when creating flutter appbundle | CC BY-SA 4.0 | null | 2020-12-14T17:39:19.387 | 2020-12-19T11:16:30.273 | 2020-12-19T11:16:30.273 | 14,825,103 | 14,825,103 | [
"android",
"flutter",
"dart",
"android-manifest",
"mobile-development"
] |
65,314,140 | 1 | 65,314,730 | null | 1 | 532 | I am working on a simple Water Reminder app. One of the final things that are left to implement is adding "Remind me later" option when the reminder notification pops. I've searched in many similar questions and articles but I didn't find solution. The thing is that I dont even know what i'm supposed to do...Start some activity, or send something to broadcast receiver or something else. I don't even know how to start trying different approaches. I will be very thankfull if someone helps me! Below is the code. What can I add to the code to implement this function?
```
public class ReminderManager {
public void createNotificationChannel() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
Uri soundUri = Uri.parse(Constants.PATH_TO_NOTIFICATION_RINGTONE);
AudioAttributes audioAttributes = new AudioAttributes.Builder()
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setUsage(AudioAttributes.USAGE_ALARM)
.build();
NotificationChannel notificationChannel = new NotificationChannel
(Constants.NOTIFICATION_CHANNEL_ID, "WaterReminderChannel", NotificationManager.IMPORTANCE_HIGH);
notificationChannel.setSound(soundUri, audioAttributes);
notificationChannel.setDescription("Channel for Water Reminder");
NotificationManager notificationManager = context.getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(notificationChannel);
}
}
public void setReminder() {
Intent intent = new Intent(context, ReminderBroadcastReceiver.class);
PendingIntent pendingIntentForBroadcast = PendingIntent.getBroadcast(context, 0, intent, 0);
AlarmManager alarmManager = (AlarmManager) context.getSystemService(ALARM_SERVICE);
AlarmManagerCompat.setExactAndAllowWhileIdle(alarmManager, AlarmManager.RTC_WAKEUP,
System.currentTimeMillis() + MainActivity.reminderTime, pendingIntentForBroadcast);
}
public class ReminderBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent i) {
if (MainActivity.reminderTime > 0 && !MainActivity.dayFinished) {
Intent intent = new Intent(context, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
Uri soundUri = Uri.parse(Constants.PATH_TO_NOTIFICATION_RINGTONE);
Notification notification = new NotificationCompat.Builder(context, Constants.NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.mipmap.water)
.setContentTitle("Water Reminder")
.setContentText("It's time to drink something!")
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setSound(soundUri)
.setDefaults(Notification.DEFAULT_VIBRATE)
.setContentIntent(pendingIntent)
.setAutoCancel(true)
.build();
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context);
notificationManager.notify(1, notification);
}
}
```
| Adding "Remind me later" option in Android notification | CC BY-SA 4.0 | null | 2020-12-15T21:44:28.860 | 2020-12-16T21:31:21.130 | null | null | 13,459,735 | [
"android",
"mobile-development"
] |
65,393,694 | 1 | null | null | 0 | 243 | I am new on Flutter, trying to do project with firebase. In my code, I can write screen only one InkWell with card, when i try to add another InkWell, project showing error.
So how can i add more than one InkWell
Here is my code;
```
import 'package:flutter/material.dart';
import 'package:whatsapp/home.dart';
import 'package:firebase_core/firebase_core.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'YOS APP',
theme: ThemeData(
primarySwatch: Colors.blue,
brightness: Brightness.dark,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: Home());
}
}
```
Here is my tabbar page;
```
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_core/firebase_core.dart';
class TabBar1 extends StatelessWidget {
const TabBar1({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return StreamBuilder(
// ignore: deprecated_member_use
stream: Firestore.instance.collection('mat1').snapshots(),
builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: Text('Loading..'));
}
return Container(
padding: EdgeInsets.all(20.0),
child: GridView.count(
crossAxisCount: 2,
// ignore: deprecated_member_use
children: snapshot.data.documents
.map(
(doc) => InkWell(onTap: () {}, child MyCard(
title: doc['konu'],
),
)
.toList(),
),
);
},
);
}
}
class MyCard extends StatelessWidget {
final String title;
const MyCard({
Key key,
this.title,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Card(
child: Center(
child: Text(title),
),
);
}
}
```
When i trying to put MyCard() widget into map area, an error occurs.
```
.map(
(doc) => MyCard(
title: doc['konu1'],
),
(doc)=> MyCard(title: doc['icerikler1'],)
)
.toList(),
```
error;
Too many positional arguments: 1 expected, but 2 found.
Try removing the extra arguments.
| Is there possible to make seperate InkWell Button with Firebase? Flutter | CC BY-SA 4.0 | null | 2020-12-21T13:31:50.750 | 2020-12-21T13:49:37.907 | null | null | 14,855,492 | [
"android",
"ios",
"flutter",
"dart",
"mobile-development"
] |
65,444,818 | 1 | 65,445,432 | null | 0 | 69 | I am new to react native and trying to work on a mobile application for fun. I am having trouble making a side menu or in other words drawer navigation. I followed the documentation given in the react native website but something that is confusing me is not being able to hide certain screens in the drawer.
For example if we have: loginScreen, signupScreen, homeScreen, profileScreen. And I want a drawer menu in the homeScreen that has a tab going to profileScreen then how would I go about achieving this? Also keep in mind that I want to press a button that goes from loginScreen to signupScreen so for that I would need to use stackNavigator.
I tried doing nested drawer and stack navigator but something isn't going right. Can someone please guide me in the correct direction that can help me achieve my goal. Thank you in advance!
| using drawer navigator and stack navigator in react native | CC BY-SA 4.0 | null | 2020-12-25T02:43:52.933 | 2020-12-25T05:03:39.240 | null | null | 13,696,220 | [
"javascript",
"react-native",
"mobile-development"
] |
65,450,719 | 1 | 65,451,432 | null | 0 | 725 | So inherited widget is useful for passing data down the tree, but how do I set that data in the first place if inherited widgets are immutable?
I'm trying to set a phone number for OTP auth and then display that number on another screen. Provider is kind of advanced for me at the moment, how do I approach this?
thank you
| How to set data in an inherited widget from a another widget? | CC BY-SA 4.0 | null | 2020-12-25T18:31:10.300 | 2020-12-25T20:14:03.423 | null | null | 12,415,598 | [
"flutter",
"flutter-provider",
"mobile-development",
"state-management",
"flutter-state"
] |
65,465,829 | 1 | 65,551,790 | null | 4 | 893 | I want to connect to Mi Fit application in a same way like [Notify for Mi Band](https://play.google.com/store/apps/details?id=com.mc.miband1&hl=en&gl=US) does. In this application there are two options to connect to Mi Band. The first one which connects to it needs auth token from freemyband and possible this also needs rooted phone/custom Mi Fit application installed. I understand this method, but there is an option to connect to Mi Band through the Mi Fit application, which needs running instance of it and it does not need rooted phone.
My question is how can I connect to the Smart Band through the Mi Fit application?
| Connecting to Mi Smart Band through Mi Fit application | CC BY-SA 4.0 | null | 2020-12-27T12:39:18.603 | 2021-01-05T12:08:03.400 | null | null | 1,436,964 | [
"android",
"bluetooth",
"mobile-development",
"xiaomi"
] |
65,492,904 | 1 | null | null | 0 | 29 | I'm trying to get api data from pixabay which returns a list of hits and the hits contain a list of the imgurls like so
[](https://i.stack.imgur.com/UGzSz.png)
and the hits contain the imageurls like so
[](https://i.stack.imgur.com/JSFrz.png)
I have tried to parse the following with the following code
```
class Hit {
final int hit;
final int totalhit;
final List <HitData> hitsdata;
Hit({
this.hit,
this.totalhit,
this.hitsdata,
});
factory Hit.fromJson (Map<String, dynamic> jsondata){
var list = jsondata['hits'] as List;
List <HitData> imageDetails = list.map((e) => HitData.fromJson(e)).toList();
return Hit(
hit: jsondata['total'],
totalhit: jsondata['totalHits'],
hitsdata: imageDetails,
);
}
}
class HitData {
final int downloads;
final String imgUrl;
final String midImgUrl;
final int likes;
final int comments;
HitData({
this.downloads,
this.comments,
this.imgUrl,
this.likes,
this.midImgUrl,
});
factory HitData.fromJson (Map<String, dynamic> parsedjson) {
return HitData(
downloads: parsedjson['downloads'],
comments: parsedjson['comments'],
imgUrl: parsedjson['largeImageURL'],
midImgUrl: parsedjson['webformatURL'],
likes: parsedjson['likes'],
);
}
}
```
and i try to print the value of image urls to consoles with this
```
Future getData () async{
try {
http.Response dataresponse = await http.get(kUrl);
if (dataresponse.statusCode == 200)
{
var bodyData = jsonDecode(dataresponse.body);
Hit hit = Hit.fromJson(bodyData);
print(hit.);
}
else {
print('lil error');
}
}catch (e){
print("Unable to get object");
print(e);
}
}
```
but the console returns a list that is filled with instance of Hitdata instead of any actual data .
please what have i done wrong here
| Displaying all of apiList data to console flutter | CC BY-SA 4.0 | null | 2020-12-29T13:26:58.230 | 2020-12-29T15:20:40.757 | null | null | 14,351,589 | [
"android",
"flutter",
"flutter-layout",
"flutter-dependencies",
"mobile-development"
] |
65,572,659 | 1 | null | null | 0 | 55 | I'm trying to implement a "swipe" animation when opening a fragment.
Right now When the fragment is being shown from my MainActivity the fragment is being scrolled down (top-to-bottom), going over and covering the Activity.
What I'm trying to achieve is that instead of the fragment being rolled on top of the activity I want it to "push" the activity out of the way on its way down. Similar to how ViewPager animations work.
[Here is a rough sketch of what I'm trying to achieve](https://i.stack.imgur.com/Ys2QI.png)
From my limited experience with ViewPager, it can be used to "Swipe" between multiple activities multiple fragments, and you cannot mix & match.
Does anyone have an elegant solution on how to achieve this?
I really don't want to convert MainActivity into a fragment because there are tons and tons of code there.
Thanks in advance <3
| Creating a "swipe" animation when inflating a fragment | CC BY-SA 4.0 | null | 2021-01-05T03:02:40.793 | 2021-01-05T10:08:40.453 | 2021-01-05T10:08:40.453 | 13,261,376 | 12,963,856 | [
"android",
"mobile-development"
] |
65,608,856 | 1 | 65,611,141 | null | -3 | 48 | I'm planning on building a portal/framework app which would launch a selection of apps. The user's log in details would determine which would be available to them. I would like to use Xamarin.Forms, as it would be multi-platform and it is the code base that I am most experienced with.
There are 2 ways that I can see this being accomplished, a large solution which contains all of the functions and only the ones available to the user are enabled (i.e. image buttons with isVisible = true/false) which navigate to each "app" homepage (this seems to be the simplest to me, but requires updating the entire solution if one "app" is updated).
Other option: a portal app through which the relevant apps are installed (with hidden icons on the phone somehow?) and the apps are launched from icons in this portal. The second solution means that the code for each app is separate and can be individually maintained/updated, it will also reduce the size of the app as only the relevant apps are installed on the phone/tablet, rather than all of the functional "apps" with most being hidden.
I have looked at some of the ways that apps are launched from another app, via deeplinking and launcher or intents and startActivity. But I can't find anything specifically for creating a portal app like I am trying to do.
Is the second option possible or feasible? If it is, are there any ideas of where to start looking at info on how to accomplish it? I have been working with Xamarin.Forms for a few months and created a few apps, so while I am not a beginner, I am not the most experienced.
| I'm trying to build a portal or framework in Xamarin.Forms which would contain multiple apps, is this possible? | CC BY-SA 4.0 | null | 2021-01-07T08:22:06.587 | 2021-01-07T11:08:36.453 | 2021-01-07T09:44:44.053 | 2,102,045 | 2,102,045 | [
"c#",
"xamarin.forms",
"mobile-development"
] |
65,646,013 | 1 | null | null | 2 | 4,491 | I Had these errors while writing a map in xcode:
```
2021-01-09 19:02:48.228694+0100 BudapestBoards[31795:558225] Metal API Validation Enabled
2021-01-09 19:02:48.433777+0100 BudapestBoards[31795:558225] This app has attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an “NSLocationWhenInUseUsageDescription” key with a string value explaining to the user how the app uses this data
2021-01-09 19:02:50.483788+0100 BudapestBoards[31795:558499] [MKCoreLocationProvider] CLLocationManager(<CLLocationManager: 0x600002b2b5b0>) for <MKCoreLocationProvider: 0x600001b30360> did fail with error: Error Domain=kCLErrorDomain Code=1 "(null)"
CoreSimulator 732.18.6 - Device: iPhone 12 Pro Max (B1F529FE-C1E7-4C0A-B918-A3C76E006F27) - Runtime: iOS 14.3 (18C61) - DeviceType: iPhone 12 Pro Max
```
i am using mapview.
my code is:
```
import UIKit
import MapKit
import CoreLocation
class ViewController: UIViewController, CLLocationManagerDelegate {
@IBOutlet weak var mapView: MKMapView!
let manager = CLLocationManager()
override func viewDidLoad() {
super.viewDidLoad()
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
manager.desiredAccuracy = kCLLocationAccuracyBest
manager.delegate = self
manager.requestWhenInUseAuthorization()
manager.startUpdatingLocation()
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
if let location = locations.first {
manager.stopUpdatingLocation()
render(location)
}
}
func render(_ location: CLLocation) {
let span = MKCoordinateSpan(latitudeDelta: 0.1, longitudeDelta: 0.1)
let coordinate = CLLocationCoordinate2D(latitude: location.coordinate.latitude, longitude: location.coordinate.longitude)
let region = MKCoordinateRegion(center: coordinate, span: span)
mapView.setRegion(region, animated: true)
}
}
}
```
Thanks for responding when adding a NSLocationWhenInUseUsageDescription it says it is already present in the dictionary and if i want to replace it. if i press on replace it does not do anything except delete that line.
| xcode MKMapView did fail with error: Error Domain=kCLErrorDomain Code=1 "(null)" | CC BY-SA 4.0 | null | 2021-01-09T18:16:44.690 | 2022-03-06T03:06:55.917 | 2021-01-10T06:08:08.883 | 3,704,384 | 14,973,593 | [
"ios",
"swift",
"xcode",
"dictionary",
"mobile-development"
] |
65,652,121 | 1 | null | null | 0 | 66 | I am working on an app based on NFC tech. When my app runs, I don't want to show users any UI, I just want it to work in background, run the algorithm and send notification. Is there any way I can do this with React Native(currently Android)?
| Can I make my app running on background without any UI | CC BY-SA 4.0 | null | 2021-01-10T10:13:11.320 | 2021-01-10T10:13:11.320 | null | null | 14,976,611 | [
"react-native",
"background-task",
"mobile-development"
] |
65,685,949 | 1 | null | null | 0 | 28 | Recently Android Studio (4.1.1) has started to act strange. I cannot debug things properly because debugger stops on a random breakpoints (I have removed all of them) I have not set any. To reach a specific breakpoint i need to keep clicking many times. Attaching few images in case it helps.
[](https://i.stack.imgur.com/Gspti.png)
[](https://i.stack.imgur.com/veWGo.png)
Hope it helps.
| Android Studio Debugger Issue | CC BY-SA 4.0 | null | 2021-01-12T14:30:41.170 | 2021-01-12T14:30:41.170 | null | null | 9,161,815 | [
"android",
"android-studio",
"kotlin",
"mobile-development"
] |
65,868,013 | 1 | null | null | 0 | 491 | I am new in react native, I have used `FlatList` which has `ListItem` as component:
```
<FlatList
style={styles.container}
data={items}
renderItem={({ item }) => (
<ListItem
title={item.title}
onPress={() => console.log("this is pressed", item.id)}
)}
/>
)}
keyExtractor={(item) => item.id.toString()}
/>
```
Everything is working fine only the
Problem is: when user scrolls the view i.e `FlatList` the point where finger is pressed that component shows `touch` effect. I want `touch` effect happened only when that element is pressed not when is scrolled. Is there any way to solve this?
1. Code for ListItem
```
import React from "react";
import { View, StyleSheet, TouchableHighlight } from "react-native";
import { AppText } from "./AppText";
import colors from "../config/colors";
import Swipeable from "react-native-gesture-handler/Swipeable";
function ListItem({title,onPress}) {
return (
<Swipeable renderRightActions={renderRightActions}>
<TouchableHighlight onPress={onPress}>
<View style={[{ backgroundColor }, styles.container]}>
<View style={styles.textContainer}>
{title && <AppText style={styles.title}>{title}</AppText>}
</View>
</View>
</TouchableHighlight>
</Swipeable>
);
}
const styles = StyleSheet.create({
container: {
flexDirection: "row",
padding: 10,
},
textContainer: {
marginLeft: 10,
justifyContent: "center",
},
title: {
fontWeight: "900",
},
});
export default ListItem;
```
| How to scroll flat list without touch effect | CC BY-SA 4.0 | null | 2021-01-24T07:20:41.053 | 2021-01-25T16:26:24.113 | 2021-01-25T16:26:24.113 | 14,087,593 | 14,087,593 | [
"react-native",
"react-native-flatlist",
"mobile-development"
] |
65,889,861 | 1 | null | null | -1 | 165 | ElectronJS is cross-platform framework to create desktop apps for Mac, Windows and Linux.
But if I make an app using responsive web design for mobile views, will the distribution for Linux work for Ubuntu Touch, Sailfish OS, Mobian, and many other Linux mobile touch operating systems?
| ElectronJS for Linux touch mobile operating systems? | CC BY-SA 4.0 | null | 2021-01-25T17:49:15.407 | 2021-04-13T07:17:52.550 | null | null | 1,936,787 | [
"linux",
"electron",
"mobile-development",
"sailfish-os",
"ubuntu-touch"
] |
65,892,287 | 1 | null | null | 2 | 173 | I want to create Ubuntu Touch mobile apps using the latest technologies from HTML5, CSS3, and JavaScript (especially Angular or VueJS). The only cross-platform hybrid framework that has a lot of community and support is ElectronJS.
But ElectronJS is for Desktop (for MacOS, Windows, and Linux).
Please take into account that the UI will be mobile responsive so that screen sizes for Phone and Tablet sizes.
| Will Ubuntu Desktop apps run on Ubuntu Touch OS and devices using Electron? | CC BY-SA 4.0 | null | 2021-01-25T20:53:49.907 | 2021-01-25T20:53:49.907 | null | null | 1,936,787 | [
"ubuntu",
"electron",
"mobile-development",
"ubuntu-touch"
] |
65,956,409 | 1 | 65,964,037 | null | 1 | 489 | I develop in Xamarin.iOS. I would like to create a Pull-Down Menu, which I saw in the [Apple Human Interface Guidelines](https://developer.apple.com/design/human-interface-guidelines/ios/controls/pull-down-menus/).
But I can not see it the [official Microsoft documentation](https://learn.microsoft.com/en-us/xamarin/ios/user-interface/controls/).
Is implemented in Xamarin.iOS? If yes, how can I use it?
| Can I make a UIMenu in Xamarin.iOS? | CC BY-SA 4.0 | null | 2021-01-29T14:32:47.383 | 2021-01-30T02:25:26.303 | null | null | 11,071,296 | [
"ios",
"xamarin",
"xamarin.ios",
"mobile-development",
"uimenu"
] |
65,976,935 | 1 | null | null | 4 | 3,877 | After I updated my Dart extension in VS Code, it doesn't automatically hot-reload my Flutter codes even though I've turned on autosave. Does anyone have an idea about how to solve it?
| VS Code Flutter auto hot reload not working after updating | CC BY-SA 4.0 | null | 2021-01-31T08:05:39.900 | 2022-08-31T17:04:05.683 | 2021-01-31T11:18:31.470 | 3,250,722 | 14,952,456 | [
"android",
"flutter",
"dart",
"visual-studio-code",
"mobile-development"
] |
65,979,674 | 1 | 65,979,774 | null | 0 | 391 | Hello guys hope your'e doing well, I'm studying delegates and protocols right now with swift. I've come across with some issue with my `viewcontroller` it says `found nil while unwrapping an Optional value` when passing the value as one of the parameters, I'm not sure what to do since if I do print `artistViewModel?.artistName` I do get the data. I'm not sure if this is related to async or completion handler.
Here's the code for my `viewcontroller`
```
import UIKit
import Alamofire
import SwiftyJSON
protocol artistViewModelDelegate {
func loadArtistViewModel(data: ArtistViewModel)
}
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, artistSearchDelegate {
@IBOutlet weak var tableView: UITableView!
var data: [ArtistItem] = []
var delegate: artistViewModelDelegate!
var artistViewModel: ArtistViewModel?
var params = [API_CONSTANTS.URL_TYPES.PARAMETERS.TERM: "Maroon 5", API_CONSTANTS.URL_TYPES.PARAMETERS.MEDIA: API_CONSTANTS.URL_TYPES.PARAMETERS.MUSIC]
override func viewDidLoad() {
super.viewDidLoad()
getItunesData()
tableView.dataSource = self
tableView.delegate = self
tableView.register(UINib(nibName: "artistCell", bundle: nil), forCellReuseIdentifier: "artistCell")
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "artistCell", for: indexPath) as! artistCell
cell.artistName.text = data[indexPath.row].artistName
cell.albumName.text = data[indexPath.row].albumName
cell.genre.text = data[indexPath.row].genre
cell.trackPrice.text = "$\(String(data[indexPath.row].trackPrice))"
cell.albumArtwork.load(url: data[indexPath.row].artwork)
cell.layer.cornerRadius = 5
cell.layer.masksToBounds = true
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
artistViewModel = ArtistViewModel(artist: data[indexPath.row])
let artistViewController = storyboard?.instantiateViewController(withIdentifier: "ArtistViewController") as! ArtistViewController
delegate.loadArtistViewModel(data: artistViewModel!) // ----> Unexpectedly found nil while unwrapping an Optional value
present(artistViewController, animated: true, completion: nil)
}
func getItunesData(){
Alamofire.request(API_CONSTANTS.URL_TYPES.URL, method: .get, parameters: params).responseJSON
{ response in
if response.result.isSuccess {
let json = JSON(response.result.value)
self.data = ArtistModel(json: json).artistItems
self.tableView.reloadData()
} else {
}
}
}
func didTapSearch(artist: String) {
params = [API_CONSTANTS.URL_TYPES.PARAMETERS.TERM:"\(artist)"]
getItunesData()
}
@IBAction func searchButton(_ sender: Any) {
let popupSearchVC = storyboard?.instantiateViewController(withIdentifier: "popupSearchView") as! PopupViewController
popupSearchVC.delegate = self
present(popupSearchVC, animated: true, completion: nil)
}
}
```
Heres `ArtistViewController` which will receive the data
```
import UIKit
class ArtistViewController: UIViewController, artistViewModelDelegate {
func loadArtistViewModel(data: ArtistViewModel) {
print(data.artistName)
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
```
And for the model `ArtistViewModel`
```
import Foundation
class ArtistViewModel {
var artistId: Int
var artistName: String
var artwork: URL
var albumName: String
var releaseDate: String
var genre: String
var trackPrice: Double
init(artist: ArtistItem){
self.artistId = artist.artistId
self.artistName = artist.albumName
self.artwork = artist.artwork
self.albumName = artist.albumName
self.releaseDate = artist.releaseDate
self.genre = artist.genre
self.trackPrice = artist.trackPrice
}
}
Hope you guys can help me with this one. Cheers
```
| passing data delegates and protocols swift | CC BY-SA 4.0 | null | 2021-01-31T13:30:37.823 | 2021-01-31T13:41:59.007 | null | null | 9,325,882 | [
"swift",
"xcode",
"delegates",
"protocols",
"mobile-development"
] |
65,981,224 | 1 | 65,981,735 | null | 0 | 498 | I am new to iOS development and I found an error that I can not get past. I have read a lot online and on Stackoverflow but I don't understand why this error keeps coming up.
Upon testing and doing breakpoints I think I was able to get the data needed[](https://i.stack.imgur.com/btSsE.png) problem is when I display it on screen wit uilabel.
```
import UIKit
class ArtistViewController: UIViewController, artistViewModelDelegate {
@IBOutlet weak var artwork: UIImageView!
@IBOutlet weak var artistName: UILabel!
@IBOutlet weak var albumName: UILabel!
func loadArtistViewModel(data: ArtistViewModel) {
guard let artistData = data as? ArtistViewModel else {}
artistName.text = artistData.artistName //Unexpectedly found nil while unwrapping an Optional value
}
override func viewDidLoad() {
super.viewDidLoad()
}
}
```
Hope you guys can help me on this one, Thank you so much!
`ViewController` where the instance of `ArtistViewController` gets called
```
import UIKit
import Alamofire
import SwiftyJSON
protocol artistViewModelDelegate {
func loadArtistViewModel(data: ArtistViewModel)
}
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource, artistSearchDelegate {
@IBOutlet weak var tableView: UITableView!
var data: [ArtistItem] = []
var delegate: artistViewModelDelegate?
var artistViewModel: ArtistViewModel?
var params = [API_CONSTANTS.URL_TYPES.PARAMETERS.TERM: "Maroon 5",API_CONSTANTS.URL_TYPES.PARAMETERS.COUNTRY: API_CONSTANTS.AU, API_CONSTANTS.URL_TYPES.PARAMETERS.MEDIA: API_CONSTANTS.URL_TYPES.PARAMETERS.MUSIC]
override func viewDidLoad() {
super.viewDidLoad()
self.delegate = ArtistViewController()
getItunesData()
tableView.dataSource = self
tableView.delegate = self
tableView.register(UINib(nibName: "artistCell", bundle: nil), forCellReuseIdentifier: "artistCell")
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return data.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "artistCell", for: indexPath) as! artistCell
cell.artistName.text = data[indexPath.row].artistName
cell.albumName.text = data[indexPath.row].albumName
cell.genre.text = data[indexPath.row].genre
cell.trackPrice.text = "$\(String(data[indexPath.row].trackPrice))"
cell.albumArtwork.load(url: data[indexPath.row].artwork)
cell.layer.cornerRadius = 5
cell.layer.masksToBounds = true
return cell
}
//Mark: To Artist ViewController
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
artistViewModel = ArtistViewModel(artist: data[indexPath.row])
let artistViewController = storyboard?.instantiateViewController(withIdentifier: "ArtistViewController") as! ArtistViewController
delegate?.loadArtistViewModel(data: artistViewModel!)
self.navigationController?.pushViewController(artistViewController, animated: true)
}
func getItunesData(){
Alamofire.request(API_CONSTANTS.URL_TYPES.URL, method: .get, parameters: params).responseJSON
{ response in
if response.result.isSuccess {
let json = JSON(response.result.value)
self.data = ArtistModel(json: json).artistItems
self.tableView.reloadData()
} else {
}
}
}
func didTapSearch(artist: String) {
params = [API_CONSTANTS.URL_TYPES.PARAMETERS.TERM:"\(artist)"]
getItunesData()
}
@IBAction func searchButton(_ sender: Any) {
let popupSearchVC = storyboard?.instantiateViewController(withIdentifier: "popupSearchView") as! PopupViewController
popupSearchVC.delegate = self
present(popupSearchVC, animated: true, completion: nil)
}
}
```
| Label.text Error! - Unexpectedly found nil while implicitly unwrapping an Optional value | CC BY-SA 4.0 | null | 2021-01-31T16:03:21.827 | 2021-01-31T16:51:12.000 | 2021-01-31T16:30:23.860 | 9,325,882 | 9,325,882 | [
"swift",
"xcode",
"option-type",
"mobile-development"
] |
65,998,280 | 1 | 66,011,903 | null | 1 | 2,635 | I was trying to find out how to request permissions in Jetpack Compose. Found [an article in official documentation](https://developer.android.com/training/permissions/requesting#request-permission), but I couldn't figure out how to use it in my case; there's also [an answer on Stack Overflow](https://stackoverflow.com/a/64080907/9645340), but I simply couldn't understand it.
I will appreciate if you show some of your examples with explanation, or help me understand the code from the answer that I mentioned.
| How to request permissions in Compose application? | CC BY-SA 4.0 | null | 2021-02-01T18:36:52.903 | 2022-07-13T10:28:30.013 | null | null | 9,645,340 | [
"android",
"android-permissions",
"mobile-development",
"android-jetpack-compose"
] |
66,079,097 | 1 | null | null | 0 | 123 | Whenever I try to run Flutter my app, the first time it will show an error like this: [error image](https://i.stack.imgur.com/PkgLd.png)
> RangeError (index): Invalid value: Valid value range is empty: 0
If I run its again by using ctrl+s, it works fine and all the errors are gone: [success](https://i.stack.imgur.com/OvV54.png)
This error is only appearing a few seconds, after it displays the wrong data until I refresh the application.
[https://pastebin.com/LYe88Bys](https://pastebin.com/LYe88Bys)
```
CarouselSlider.builder(
options: CarouselOptions(viewportFraction: .99, autoPlay: true),
// itemCount: showp.shows.length.compareTo(0),
itemCount: showp.shows.length,
itemBuilder: (BuildContext context, int index, int realIndex) {
return BannerWidget(
image: showp.shows[index].bannerImage,
title: showp.shows[index].showTitle,
);
},
)
```
| RangeError (index): Invalid value: Valid value range is empty: 0 while fetching data from rest api | CC BY-SA 4.0 | null | 2021-02-06T16:21:31.967 | 2021-02-07T05:21:25.983 | 2021-02-07T05:21:25.983 | 12,326,283 | 13,098,689 | [
"android",
"flutter",
"dart",
"mobile-development"
] |
66,098,977 | 1 | 66,099,036 | null | 0 | 3,711 | When I try to add flutter_svg dependency to add SVG format picture in my project it throws me an error like that:
[](https://i.stack.imgur.com/W5jjo.png)
```
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.19.2+1/lib/src/picture_provider.dart:57:59: Error: No named parameter with the name 'nullOk'.
context != null ? Localizations.localeOf(context, nullOk: true) : null,
^^^^^^
/C:/src/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match.
static Locale localeOf(BuildContext context) {
```
I'm using flutter (Channel master, 1.26.0-18.0.pre.193). and flutter_svg: ^0.19.2+1
I've also with a lower version of this dependency, but still the same error.
| Flutter Dependency Error (flutter_svg: ^0.19.2+1) | CC BY-SA 4.0 | null | 2021-02-08T09:31:21.470 | 2021-02-25T12:16:31.763 | 2021-02-08T09:39:38.823 | 1,364,007 | 11,340,437 | [
"android",
"flutter",
"flutter-dependencies",
"mobile-development"
] |
66,104,120 | 1 | 66,105,322 | null | -3 | 139 | When I use the "next article" button to jump to the article details page with index 3, I want to go directly back to the article list page instead of the article details page with index 2.I tried to search for methods to return to the specified page and destroy the page, but I didn't find them.How to achieve this effect in swiftui?Thanks.I guess the same scenario will happen in other mobile development, right?
The ArticleListView is :
```
struct ArticleListView: View {
@EnvironmentObject var modelData:ModelData
var body: some View {
NavigationView{
List{
ForEach(modelData.articleList){ article in
NavigationLink(destination:ArticleDetail(index:article.index)){
ArticleItem(index:article.index);
}
}
}
.listStyle(PlainListStyle())
}
}
}
```
The ArticleDetail is like this:
```
struct ArticleDetail: View {
@EnvironmentObject var modelData:ModelData
var index:Int
var body: some View {
VStack{
Text(modelData.articleList[index].htmlText)
NavigationLink(destination:ArticleDetail(index:self.index+1)){
Text("next article")
}
}
}
}
```
The Article/ArticleItemView/ModelData is like this:
```
struct Article:Identifiable{
var id = UUID()
var index:Int
var htmlText:String
}
struct ArticleItem: View {
@EnvironmentObject var modelData:ModelData
var index:Int
var body: some View {
Text(modelData.articleList[index].htmlText)
}
}
final class ModelData:ObservableObject {
@Published var articleList = [Article(index:0,htmlText: "first test text "),Article(index:1,htmlText: "second test text"),Article(index:2,htmlText: "third test text")]
}
```
| How to jump from one detail page to another and return to the list page in SwiftUI? | CC BY-SA 4.0 | null | 2021-02-08T15:04:53.730 | 2021-02-10T14:33:40.200 | 2021-02-09T06:06:30.773 | 11,983,451 | 11,983,451 | [
"ios",
"swift",
"swiftui",
"mobile-development",
"swiftui-navigationlink"
] |
66,127,438 | 1 | null | null | 2 | 1,287 | I am building a Flutter Application, and for one of the API's I am using, it does not have Flutter support, only Android and iOS. My solution to this was to use Platform Channels, but how would I pass an Image as an argument?
To explain a little further, I am picking an image from the gallery with `ImagePicker().getImage` in the dart file, and I want to send the image selected to the method in the Kotlin file that will do something with the image on its end and return a string.
After looking at the docs, I was able to make a channel like this:
```
static const platform = const MethodChannel('app.dev/channel');
final string result = await platform.invokeMethod('returnStringfromImage');
```
And in the Kotlin file:
```
private val CHANNEL = "app.dev/channel"
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler {
// Note: this method is invoked on the main thread.
call, result ->
if (call.method == "returnStringfromImage") {
val return = returnStringfromImage(call.arguments)
}
else {
result.notImplemented()
}
}
}
```
How would I send the image over, and pass it as an argument for the returnStringfromImage() method? Thank you!
| Sending an Image as an Argument for a Flutter Platform Channel Method | CC BY-SA 4.0 | null | 2021-02-09T21:29:09.813 | 2021-02-09T21:52:46.017 | null | null | 12,944,988 | [
"android",
"flutter",
"dart",
"mobile-development",
"flutter-platform-channel"
] |
66,162,829 | 1 | null | null | 0 | 219 | I've tried to add an Apple Developer Account in Visual Studio 2017 but when I go , the Add button is disabled:
[Xamarin options](https://i.stack.imgur.com/3p54d.png)
I have tried to update but still isn't working (Visual Studio Enterprise 2017 15.9.29), besides I have a Mac paired already by IP
| Add Apple Developer Account in Visual Studio 2017 | CC BY-SA 4.0 | null | 2021-02-11T21:05:30.317 | 2021-02-12T03:31:45.473 | null | null | 7,680,014 | [
"ios",
"macos",
"xamarin",
"mobile-development",
"apple-developer-account"
] |
66,180,919 | 1 | null | null | 0 | 48 | I am trying to make an iOS app to calculate quadratic equations. I am fairly new to all this UIKit stuff so after long days of trying to figure out how I could fix this, I still have no answer, hence why I am asking this question. I am trying to make a button display 2 different answers in 2 boxes, as you would, in a quadratic equation. I do not know what I may have done wrong and I don't know if it's something external to this code. Thanks in advance.
```
using Foundation;
using System;
using UIKit;
using static System.Net.Mime.MediaTypeNames;
namespace Quadeq
{
public partial class ViewController : UIViewController
{
public ViewController(IntPtr handle) : base(handle)
{
}
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
}
public override void DidReceiveMemoryWarning()
{
base.DidReceiveMemoryWarning();
// Release any cached data, images, etc that aren't in use.
}
public static void Calculatebutton_TouchUpInside(UIButton sender)
{
static void idk(Answer1 hi, Textfield3 c, Textfield2 b, textfield1 a, bool pos)
{
string quad = Convert.ToString(quadform(a, b, c, true));
hi.Text = quad;
}
static void idek(Answer2 heyy, Textfield3 c, Textfield2 b, textfield1 a, bool pos)
{
string quad = Convert.ToString(quadform(a, b, c, false));
heyy.Text = quad;
}
idk();
idek();
}
static void idk(Answer1 hi, Textfield3 c, Textfield2 b, textfield1 a, bool pos)
{
string quad = Convert.ToString(quadform(a, b, c, true));
hi.Text = quad;
}
static void idek(Answer2 heyy, Textfield3 c, Textfield2 b, textfield1 a, bool pos)
{
string quad = Convert.ToString(quadform(a, b, c, false));
heyy.Text = quad;
}
static int Textnumber1(UITextField t)
{
int num = int.Parse(t.Text);
return num;
}
static double quadform(textfield1 a, Textfield2 b, Textfield3 c, bool pos)
{
int okay = Textnumber1(a);
int owkie = Textnumber1(b);
int yay = Textnumber1(c);
var preRoot = owkie * owkie - 4 * okay * yay;
if (preRoot < 0)
{
return double.NaN;
}
else
{
var sgn = pos ? 1.0 : -1.0;
return (sgn * Math.Sqrt(preRoot) - owkie) / (2.0 * okay);
}
}
}
}
```
| Why can't I use my methods within a method? | CC BY-SA 4.0 | null | 2021-02-13T00:53:14.890 | 2021-02-13T11:21:28.057 | 2021-02-13T10:42:58.317 | 15,201,029 | 15,201,029 | [
"c#",
"ios",
"xcode",
"visual-studio",
"mobile-development"
] |
66,184,076 | 1 | null | null | 1 | 133 | First, I don't know how to call this in android development. I am trying to search on the internet but found nothing.
Scenario:
-
My question:
-
For example -- [http://192.168.1.1:7575/](http://192.168.1.1:7575/)
Link above will open a user interface that connected to my app and I could do database functions on it. If I change the data then it will change the data on android app as well.
Btw, I'm not native english speaker. Thanks.
See this image below: The right side is an android app that running on android device. The left side is web version that connected to the android device with a url. If I close the app on android, the web version also unavailable. It's only one app, an android app. I don't know how to achieve this ability.
[link here](https://play.google.com/store/apps/details?id=com.gentatekno.app.portable.kasirtoko)
[](https://i.stack.imgur.com/eYUNK.png)
| How to open android app in PC browser with http protocol? | CC BY-SA 4.0 | null | 2021-02-13T10:29:25.750 | 2021-02-13T11:51:11.437 | 2021-02-13T11:51:11.437 | 9,643,897 | 9,643,897 | [
"java",
"android",
"kotlin",
"mobile-development"
] |
66,208,648 | 1 | null | null | 0 | 535 | I am developing applications for iPhones. i have xcode version 11.2.1. My iPhone is updated to iOS 14 and now i am no longer able to run apps in iPhone via XCode, because it says I need to have an updated version of XCode. I visited App Store XCode page, and it says below
> Requires MacOS 10.15.4 or later
My MacOS Version is 10.15.2. I am unable to update MacOS because I only have 14 GB left in my hard drive. My hard drive is only 121 GB. To install MacOS, it is asking me for 20.81 GB free eventhough the download is like 4.8GB
[](https://i.stack.imgur.com/du59w.png)
I ran DaisyDisk check (I have paid version) below is the result.
[](https://i.stack.imgur.com/OHOnU.png)
Then
[](https://i.stack.imgur.com/DMK1Z.png)
For your note, XCode and Android studio has taken most space. I am using this laptop mainly for Mobile development.
[](https://i.stack.imgur.com/48w4V.png)
Now I have 2 problems.
1. Unable to update XCode because MacOS is old
2. Unable to update MacOS because no space is left.
I have removed the XCode derived data, checked for local snapshots, uninstalled some applications, removed Android emulators and still only managed to free just 14.4 GB. The only other thing I can think of is removing MS Office package which will clear 6GB.
However if MacOS update is asking for 20.1 GB, I am not sure how much XCode will ask for. Maybe another 12-20 GB.
What should I do to update MacOS and Xcode at this stage? After removing so many files and few applications, I clearly fear to remove more things blindly without knowing whether it will help or not to update both MacOS and XCode. If it does, I have no problem. If it helps, I have 1 TB external hard disk which I have not used yet.
| Unable to update XCode: Requires MacOS 10.15.4 or later | CC BY-SA 4.0 | 0 | 2021-02-15T13:08:00.740 | 2021-02-15T13:46:09.843 | 2021-02-15T13:46:09.843 | 1,379,286 | 1,379,286 | [
"ios",
"xcode",
"macos",
"macos-catalina",
"mobile-development"
] |
66,223,546 | 1 | 68,494,319 | null | 5 | 5,998 | I am trying to update XCode from 11.2.1 to 12.4. I installed XCode from the app-store, so I am trying to update it from there itself.
I have 27 GB of free space, but every time I try to update, it says I do not have sufficient space.
[](https://i.stack.imgur.com/yVFq5.png)
I don't think there is anything else I can delete. I removed the `deviceSupport`, `derivedData`, `archives`, `unavailable simulators` etc. I am on MacOS Catalina 10.15.7. This MacBook only has 128GB hard drive.
Without updating XCode I can't run My iOS 14 test devices with this.I dont need the latest version, just the version capable of running iOS 14 devices.
How much space does this XCode consume? How can I update this?
| Unable to Update XCode: Not enough space | CC BY-SA 4.0 | 0 | 2021-02-16T11:30:09.020 | 2022-04-19T15:46:12.670 | null | null | 1,379,286 | [
"ios",
"xcode",
"macos",
"macos-catalina",
"mobile-development"
] |
66,270,557 | 1 | 66,270,688 | null | 1 | 669 | I started developing apps using React Native expo and I have never used Mac in my life. When I went to apple's developer site, it is written there that,
[https://developer.apple.com/ios/submit/](https://developer.apple.com/ios/submit/)
Does that mean that we can't publish react native apps using expo without Xcode from April-2021? What if I want to make changes to the already published React Native app,Do I have to run it only in the Xcode? Can anyone please enlighten me?
Thanks in advance.
| Is building iOS apps with Xcode12 mandatory from April-2021? | CC BY-SA 4.0 | null | 2021-02-19T01:30:11.960 | 2021-02-19T01:48:01.887 | null | null | 9,933,821 | [
"ios",
"xcode",
"react-native",
"expo",
"mobile-development"
] |
66,301,849 | 1 | 66,302,541 | null | 6 | 2,583 | I wanted to know if we can check if two widgets in flutter are overlapping. I actually have two AnimatedContainer stacked using Stack. I wanted to check if the children of the two overlap. I actually am creating a game from scratch and wanted to check collisions. Though x's and y's are an option, but it depends on height and width of the two objects and as they are having different, so results are very inaccurate.
Any help would be appreciated.
| How to check if two widgets are overlapping in flutter? | CC BY-SA 4.0 | null | 2021-02-21T11:32:03.630 | 2022-08-30T05:44:33.070 | null | null | 14,989,978 | [
"flutter",
"dart",
"flutter-animation",
"mobile-development",
"flutter-widget"
] |
66,316,310 | 1 | null | null | 0 | 489 | I am trying to load audio files and play them. But Visual Studio codes open a file named 'asset_bundle.dart' showing this piece of code -
```
if (asset == null)
throw FlutterError('Unable to load asset: $key');
return asset;
}
```
Here's my pubspec.yaml file -
```
dependencies:
flutter:
sdk: flutter
audioplayers: 0.15.1
assets:
- assets/audio/
```
Here's my code -
```
import 'package:audioplayers/audio_cache.dart';
void playSound(String audioPath) {
AudioCache audioCache = new AudioCache(prefix: 'assets/audio');
audioCache.play(audioPath);
}
playSound('swoosh.wav');
```
And the asset folder added in 'pubspec.yaml' lies in the same folder as 'pubspec.yaml' and also it contains 'swoosh.wav' file.
I have tried 'flutter run' command.
Please Help me.
| Flutter : Can't load Assets (Audio file particularly) | CC BY-SA 4.0 | null | 2021-02-22T13:07:28.633 | 2021-02-22T13:07:28.633 | null | null | 14,989,978 | [
"flutter",
"dart",
"audio-player",
"dart-pub",
"mobile-development"
] |
66,319,218 | 1 | null | null | 0 | 47 | My application requires the function of sending attached files from external storage by email using third-party applications like GMail. However, when I try to do this, an exception is thrown that does not clarify the situation.
```
public class MainActivity extends AppCompatActivity {
File simpleFile;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
simpleFile = new File(getExternalFilesDir(null), "simple_file.txt");
FileOutputStream fos = null;
try {
if (!simpleFile.exists()) {
simpleFile.createNewFile();
}
fos = new FileOutputStream(simpleFile);
fos.write("Some simple text".getBytes());
} catch (IOException ex) {
ex.printStackTrace();
} finally {
try {
if (fos != null) {
fos.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
public void sendEmail(View view) {
// triggered when the button is clicked
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {"xxxxxxx@gmail.com"});
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Some subject");
emailIntent.putExtra(Intent.EXTRA_TEXT, "Some text");
Uri uri = Uri.fromFile(simpleFile);
emailIntent.putExtra(Intent.EXTRA_STREAM, uri);
emailIntent.setType("text/plain");
startActivity(Intent.createChooser(emailIntent, "Send email"));
}
}
```
The error occurs when startActivity() is triggered in the last line.Help me please figure out where the problem lies.
Stacktrace:
```
Process: com.example.checksendemail, PID: 13328
java.lang.IllegalStateException: Could not execute method for android:onClick
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:414)
at android.view.View.performClick(View.java:6256)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:992)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:409)
at android.view.View.performClick(View.java:6256)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:992)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: android.os.FileUriExposedException: file:///storage/emulated/0/Android/data/com.example.checksendemail/files/simple_file.txt exposed beyond app through ClipData.Item.getUri()
at android.os.StrictMode.onFileUriExposed(StrictMode.java:1958)
at android.net.Uri.checkFileUriExposed(Uri.java:2356)
at android.content.ClipData.prepareToLeaveProcess(ClipData.java:941)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9735)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9741)
at android.content.Intent.prepareToLeaveProcess(Intent.java:9720)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1609)
at android.app.Activity.startActivityForResult(Activity.java:4472)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:676)
at android.app.Activity.startActivityForResult(Activity.java:4430)
at androidx.fragment.app.FragmentActivity.startActivityForResult(FragmentActivity.java:663)
at android.app.Activity.startActivity(Activity.java:4791)
at android.app.Activity.startActivity(Activity.java:4759)
at com.example.checksendemail.MainActivity.sendEmail(MainActivity.java:59)
at java.lang.reflect.Method.invoke(Native Method)
at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:409)
at android.view.View.performClick(View.java:6256)
at com.google.android.material.button.MaterialButton.performClick(MaterialButton.java:992)
at android.view.View$PerformClick.run(View.java:24701)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) ```
```
| Error when sending an email with an attached file | CC BY-SA 4.0 | null | 2021-02-22T16:08:43.150 | 2021-02-22T16:14:43.950 | 2021-02-22T16:14:43.950 | 10,514,943 | 10,514,943 | [
"java",
"android",
"mobile-development"
] |
66,334,289 | 1 | 66,334,455 | null | 2 | 4,580 | I am trying to make snake 2 in flutter. And I have used Timer.periodic() for game loop. And I tried specifying duration as 1 seconds. But the code inside the Timer.periodic() runs multiple times in a second. I also tried debugging (though I am terrible at that) and found that the code inside the Timer.periodic() ran multiple times without stepping out of it. Though while debugging this couild happen as the code pauses for input. But I'm not sure about anything .Here is my code -
```
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
class SnakePage extends StatefulWidget {
@override
_SnakePageState createState() => _SnakePageState();
}
class _SnakePageState extends State<SnakePage> {
int score = 0;
String swipe = '';
bool running = false;
int iterates = 0;
List snake = [
[
[4, 3],
1,
true
],
[
[4, 2],
1,
false
],
[
[4, 1],
1,
false
],
];
// Convert radians to degree
double radians(double degree) {
return ((degree * 180) / pi);
}
void turn(moveEvent) {
double angle = radians(moveEvent.delta.direction);
if (angle >= -45 && angle <= 45) {
this.swipe = 'Swipe Right';
} else if (angle >= 45 && angle <= 135) {
this.swipe = 'Swipe Down';
} else if (angle <= -45 && angle >= -135) {
this.swipe = 'Swipe Up';
} else {
this.swipe = 'Swipe Left';
}
}
int toIndex(coOrdinates) {
return ((coOrdinates[0] + 1) * 10) + coOrdinates[1];
}
void run() {
this.running = true;
Timer.periodic(
Duration(
milliseconds: 500,
), (timer) {
this.setState(() {
this.iterates += 1;
this.swipe = this.iterates.toString();
for (var i = 0; i < this.snake.length; i++) {
this.snake[i][0][1] += 1;
if (this.snake[i][0][1] == 10) {
this.snake[i][0][1] = 0;
}
}
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('WC'),
),
body: Listener(
onPointerMove: this.running
? (moveEvent) => this.turn(moveEvent)
: (moveEvent) => this.run(),// Where the function is being called
child: Container();
);
}
}
```
And please pardon me for code being a mess and not well commented.
Any Help would be appreciated!
| Flutter : Timer.periodic running multiple times in each iteration | CC BY-SA 4.0 | null | 2021-02-23T13:42:25.863 | 2023-01-25T08:12:33.083 | null | null | 14,989,978 | [
"flutter",
"dart",
"mobile-development"
] |
66,346,531 | 1 | null | null | 1 | 248 | I want to release my app to google play store with SDK level 29, shall I select yes or no for "Does your app access location in the background in APKs or app bundles targeting Android 9 (Pie) or older (SDK level 28 or lower)"?
The problem is it says “Does my app use location in the background with SDK level 28” answer is yes. However, the one I am submitting is with SDK29 and it doesn’t use location in the background so the answer is NO, but it’s not asking for the app with SDK version 29.
It's asking what it's doing with SDK28 which is irrelevant with the current version.
If the answer is wrong they will remove the app from the play store! Please advice.
| Does your app access location in the background in APKs or app bundles targeting Android 9 (Pie) or older (SDK level 28 or lower)? | CC BY-SA 4.0 | null | 2021-02-24T07:36:23.010 | 2021-02-25T19:04:47.293 | 2021-02-25T19:04:47.293 | 1,255,890 | 1,255,890 | [
"android",
"react-native",
"google-play",
"mobile-development"
] |
66,363,888 | 1 | 66,367,038 | null | -1 | 77 | Xamarin.Forms 5.0 IOS shows black screen immediately after the splash screen.
In debug mode, I was able to access the application but when I changed it to release mode and pushed to test flight, both debug and release modes shows black screen after the splash screen, What could be the issue, please help.
| Question - Xamarin.Forms 5.0 IOS black screen | CC BY-SA 4.0 | null | 2021-02-25T07:11:53.543 | 2021-02-25T10:48:18.427 | null | null | 15,211,262 | [
"ios",
"xamarin",
"xamarin.forms",
"mobile-development"
] |
66,421,730 | 1 | 66,422,094 | null | 1 | 1,104 | I'm developing an app in flutter and, after a certain event occurs in the background, I need to trigger an alarm that alert the user. I was only able to trigger a pop-up notification but not an alarm. How can I do?
| How to trigger an alarm after a certain event in flutter? | CC BY-SA 4.0 | null | 2021-03-01T11:58:02.987 | 2021-03-01T12:24:42.800 | null | null | 13,526,464 | [
"flutter",
"dart",
"alarm",
"mobile-development"
] |
66,429,040 | 1 | 66,535,705 | null | 0 | 141 | I am trying to implement AWS Pinpoint in my project for mobile-analytics purposes, when I am trying to create an event in AWS Pinpoint that will be triggered on OnClickListerner. Following is the code snippet. Whenever I am trying to create an event in OnClickListener, that particular event is not recognized, please help me out regarding how it is done.
```
inviteButton.setOnClickListener {
val tinyDb = TinyDB(App.ctx)
val userDetails = tinyDb.getCurrentUserCachedDetails()
val userAttributesMap = userDetails.attributes.attributes
val username =
userAttributesMap[SettingsFragment.KEY_FIRST_NAME] + " " + userAttributesMap[SettingsFragment.KEY_LAST_NAME]
val project = ProjectRepository(ProjectDao()).getProjectById(projectCode)
val bitmap =
BitmapFactory.decodeResource(resources, R.drawable.project_invite)
val mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true)
val canvas = Canvas(mutableBitmap)
val scale = resources.displayMetrics.density
val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
color = Color.BLACK
textSize = 100 * scale
}
canvas.drawText(
projectCode.toString(),
400.toFloat() * scale,
440.toFloat() * scale,
paint
)
val originalFile = File(App.ctx.externalMediaDirs[0], "project_invite.png")
originalFile.createNewFile()
val originalFileBos = ByteArrayOutputStream()
mutableBitmap.compress(Bitmap.CompressFormat.PNG, 0, originalFileBos)
val originalFileByteArray = originalFileBos.toByteArray()
val originalFileFos = FileOutputStream(originalFile)
originalFileFos.write(originalFileByteArray)
originalFileFos.flush()
originalFileFos.close()
val defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(App.ctx)
val intent = Intent(Intent.ACTION_SEND)
intent.putExtra(
Intent.EXTRA_STREAM,
FileProvider.getUriForFile(
App.ctx,
"${App.ctx.packageName}.fileprovider",
originalFile
)
)
intent.putExtra(Intent.EXTRA_TEXT, message)
intent.putExtra("sms_body", message)
intent.type = "image/png"
defaultSmsApp?.let {
intent.`package` = it
try {
activity?.startActivity(intent)
} catch (e: ActivityNotFoundException) {
e { e }
toastError("Unable to open SMS app.")
}
} ?: toastError("No default SMS app found.")
val Email = tinyDb.getString(getString(R.string.logged_in_user))
val event = AnalyticsEvent.builder()
.name("invites")
.addProperty("email", Email)
.build()
log { "Invite event"+ event }
Amplify.Analytics.recordEvent(event)
log { "Invite here 11"+ Amplify.Analytics.recordEvent(event) }
}
```
| How to create an event in AWS pinpoint which can be triggered by OnClick event in Android Kotlin | CC BY-SA 4.0 | null | 2021-03-01T20:15:14.257 | 2021-03-08T19:06:59.840 | null | null | 13,691,671 | [
"android",
"kotlin",
"aws-amplify",
"mobile-development",
"aws-pinpoint"
] |
66,477,217 | 1 | 66,478,875 | null | 1 | 140 | I think those two are related and I'm probably doing something wrong here:
First I'm overriding viewForAnnotation - in order to put my custom Image
```
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id<MKAnnotation>)annotation
{
// we avoid changing the user's location blue point
if([annotation isKindOfClass: [MKUserLocation class]]) {
return nil;
}
else
{
static NSString *SFAnnotationIdentifier = @"SFAnnotationIdentifier";
MKPinAnnotationView* pinAnnotationView = (MKPinAnnotationView*)[self.mapToPin dequeueReusableAnnotationViewWithIdentifier:SFAnnotationIdentifier];
if (!pinAnnotationView)
{
MKAnnotationView *annotationView = [[MKAnnotationView alloc] initWithAnnotation:annotation
reuseIdentifier:SFAnnotationIdentifier];
UIImage *littleImage = [UIImage imageNamed:@"littleImage.png"];
// You may need to resize the image here.
annotationView.image = littleImage;
pinAnnotationView.draggable = true;
pinAnnotationView.canShowCallout = true;
pinAnnotationView.animatesDrop = true;
return annotationView;
}
else
{
pinAnnotationView.annotation = annotation;
}
return pinAnnotationView;
}
}
```
It seems that pinAnnotationView's , and are not working.
Then, I'm calling my method in my viewDidLoad to set the Annotation
```
-(void) setAnnotation:(NSString*)lat : (NSString*)lng
{
_mapAnnotation = [[MKPointAnnotation alloc] init];
CLLocationCoordinate2D coordinateForPin;
coordinateForPin.latitude = [lat floatValue];
coordinateForPin.longitude = [lng floatValue];
[_mapAnnotation setCoordinate:coordinateForPin];
[_mapAnnotation setTitle:@"sometitle"];
[_mapToPin addAnnotation:_mapAnnotation];
}
```
It seems that [_mapAnnotation setTitle:@"sometitle"]; is not working anymore when I'm overriding viewForAnnotation.
Is this the right way to go? I have been browsing but didn't find any solution that could help. Any feedback would be appreciated.
| MKPointAnnotation title not showing and annotation not draggable | CC BY-SA 4.0 | null | 2021-03-04T14:37:16.693 | 2021-03-04T18:04:59.867 | null | null | 7,356,056 | [
"ios",
"mkannotationview",
"mobile-development",
"mkpinannotationview",
"mkpointannotation"
] |
66,553,545 | 1 | null | null | 0 | 145 | I just opened my project and its getting me this error out of nowhere have checked activity in
its problem from the line up there cant find any solution for it any help please !
have tried creating a new project and copying all the files also same error and have tried flutter clean , flutter build .
[1]: [https://i.stack.imgur.com/mKzAO.png](https://i.stack.imgur.com/mKzAO.png)
| Execution failed for task ':app:compileDebugKotlin' Unresolved reference: embedding | CC BY-SA 4.0 | null | 2021-03-09T19:30:34.833 | 2021-03-09T21:26:27.430 | null | null | 15,363,525 | [
"flutter",
"mobile-development"
] |
66,622,855 | 1 | 66,623,019 | null | -2 | 159 | I searched for this question here and there are lots of answers, but they are all outdated. I googled it and saw answers but I'm curious about your personal experience in learnin android development. So where do I need to start and what should I learn to become Junior Android Developer?
| Where to start with Android development in 2021? | CC BY-SA 4.0 | null | 2021-03-14T09:25:08.413 | 2021-03-14T09:44:06.733 | null | null | 14,582,987 | [
"android",
"mobile-development"
] |
66,679,273 | 1 | null | null | 0 | 113 | I am trying to make a screen on React Native that has a grid of images which are buttons, When an image/button is pressed, it will take the user to a different screen, and in some cloud or backend it will be saved that the user pressed on that image on that day.
How do I do all of this?? I know I should use React Native for the front end, should I use Firebase for the cloud and backend? How do I make the login for the site and save it for each user? Should I use a flatlist or scrollview? I know you can do multiple columns for a flatlist, but scrollview is better for saving states. Pls help me I need to have this application done by the end of next week and I am very, very lost.
| React Native - how to make a grid of buttons | CC BY-SA 4.0 | null | 2021-03-17T18:38:33.730 | 2021-03-17T18:38:33.730 | null | null | 15,417,704 | [
"reactjs",
"firebase",
"react-native",
"mobile-development"
] |
66,708,045 | 1 | null | null | 2 | 223 | I am using SelectionTracker.Builder to multi select items in the RecyclerView. But after selecting first item, SelectionTracker selects other items on dragging too. I want to disable drag to select feature and keep only Click to select multiple items. Is there any way to it?
```
.withSelectionPredicate(new SelectionTracker.SelectionPredicate<String>() {
@Override
public boolean canSetStateForKey(@NonNull String key, boolean nextState) {
return true;
}
@Override
public boolean canSetStateAtPosition(int position, boolean nextState) {
return true;
}
@Override
public boolean canSelectMultiple() {
return true;
}
}).build();
```
I tried SelectionPredicate but this also limited the number of items that can be selected to 1.
| How to disable drag to selection using SelctionTracker in Recyclerview? | CC BY-SA 4.0 | null | 2021-03-19T12:18:55.807 | 2023-02-20T20:57:18.313 | 2021-03-20T06:31:55.757 | 13,276,225 | 13,276,225 | [
"android",
"android-recyclerview",
"mobile-development"
] |
66,718,965 | 1 | null | null | 3 | 507 | How can I set my device name for bluetooth in Flutter?
In Java, there is one plugin BluetoothAdapter which could be used to set the bluetootg device name, but in Flutter, I did not find a way to do this.
thanks
| How to change bluetooth device name in Flutter? | CC BY-SA 4.0 | null | 2021-03-20T06:47:49.013 | 2021-03-20T13:35:34.760 | null | null | 14,952,456 | [
"android",
"ios",
"flutter",
"bluetooth",
"mobile-development"
] |
66,719,474 | 1 | null | null | 0 | 97 | im making a game on react native and to have multiple players i used socket io to have real time data communication. The problem im facing is that 4 devices in 1 room playing having lag problems because of too much socket events going to the server and to the device.
Im trying to solve this problem using RabbitMQ but i have no idea if this is the right way.
RabbitMQ server between the socket server and devices. This is the architecture i have in mind , what do yall think?
| Socket IO + React Native + Rabbit MQ Architecture mix? | CC BY-SA 4.0 | null | 2021-03-20T08:08:12.410 | 2021-03-24T10:17:06.700 | 2021-03-20T10:01:05.243 | 15,438,208 | 15,438,208 | [
"react-native",
"sockets",
"architecture",
"game-development",
"mobile-development"
] |
66,740,475 | 1 | 66,747,575 | null | 1 | 210 | There are many packages in Flutter dealing with things related to Bluetooth but none of them enables me to see the Bluetooth address of my own device, does anyone know to do that?
thank you in advance?
| how to get the bluetooth address of my own device in Flutter? | CC BY-SA 4.0 | null | 2021-03-22T04:49:39.837 | 2021-03-22T14:02:06.300 | null | null | 14,952,456 | [
"android",
"flutter",
"bluetooth",
"android-bluetooth",
"mobile-development"
] |
66,781,929 | 1 | null | null | 1 | 47 | I'm trying to implement a slider in my react native app. I'm using the [react-native-web-swiper](https://www.npmjs.com/package/react-native-web-swiper) library. I'm using the useState hook to monitor which index the swiper is on. In the onIndexChanged() prop of the swiper, I update the state (current index). My problem is that the onPress event for my swiper components doesn't use the updated state.
```
export default ({ navigation, route }: any) => {
const pages = DataController.getData().onboardingPages;
const swiper = useRef<Swiper>(null);
const [index, setIndex] = useState<number>(0);
const handleNextButton = () => {
console.log("INDEX IN BUTTON PRESS", index); // index is zero here?? it should be 0,1,2, or 3
if (index !== pages.length - 1) {
swiper.current?.goToNext();
} else {
navigation.replace("Landing");
}
};
useEffect(() => {
console.log("useeffect called with index ", index); // index is correct here
}, []);
useLayoutEffect(() => {
console.log("uselayouteffect called with index ", index); // index is correct here
if (index !== pages.length - 1) {
navigation.setOptions({
headerRight: () => (
<Text
style={styles.skip}
onPress={() => navigation.replace("Landing")}
>
Skip
</Text>
),
});
} else {
navigation.setOptions({
headerRight: undefined,
});
}
}, [index]);
return (
<Swiper
ref={swiper}
controlsProps={{
prevTitle: "",
nextTitle: "",
prevPos: false,
nextPos: false,
}}
// controlsEnabled={false}
loop={false}
onIndexChanged={index => {
console.log("index changed to ", index);
setIndex(index);
}}
>
{pages.map(item => {
return (
<OnboardingPage
key={item.pageNumber}
text={item.text}
image={item.image}
handleNextButton={handleNextButton}
/>
);
})}
</Swiper>
);
};
const styles = StyleSheet.create({
skip: {
marginRight: 10,
fontFamily: "an-regular",
fontSize: 17,
fontWeight: "normal",
fontStyle: "normal",
lineHeight: 26,
letterSpacing: -0.2,
color: Colours.P_80,
},
});
```
| Updated state is not reflected in my onPress event | CC BY-SA 4.0 | null | 2021-03-24T13:20:24.753 | 2021-03-24T13:20:24.753 | null | null | 6,286,413 | [
"typescript",
"react-native",
"swiper.js",
"mobile-development"
] |
66,804,462 | 1 | null | null | 0 | 18 | In my app Ive got details about movies from the user and saved them in a sqlite database , from this database ive created listview which displays the names of the movies with checkboxes where the user can check to mark the movie as one of his/her favorites.
Ive got a separate column to store if a movie is a favorite or not.... initially ive declared all the movies as "not favorites" so when the user checks the checkbox and press the button "mark as favorites" the value of the column favorites corresponding to that movie updates from "not favorites" to "favorites"
what I want to do is , keep the user selected movies checked all the time in the checkbox even after a restart of the application. As in the state should not be changed.
Code to create the list view
```
public class DisplayActivity extends AppCompatActivity {
DataBaseHelper myDb;
ListView movieNList;
Button addFavoritesB,button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display);
movieNList =(ListView) findViewById(R.id.moviesLV);
myDb=new DataBaseHelper(this);
addFavoritesB=(Button) findViewById(R.id.addButton);
button=(Button) findViewById(R.id.button);
ArrayList<String> theList=new ArrayList<>();
Cursor data=myDb.getData();
if (data.getCount()==0){
Toast.makeText(DisplayActivity.this,"The Database is empty",Toast.LENGTH_SHORT).show();
}else{
//Adds data to the list view
while(data.moveToNext()){
theList.add(data.getString(1));
Collections.sort(theList);
ListAdapter listAdapter=new ArrayAdapter<>(this, android.R.layout.simple_list_item_multiple_choice,theList);
movieNList.setAdapter(listAdapter);
}
}
buttonAction();
viewAll();
}
```
XML code
```
<ListView
android:id="@+id/moviesLV"
android:layout_width="412dp"
android:layout_height="414dp"
android:choiceMode="multipleChoice"
app:layout_constraintBottom_toTopOf="@+id/addButton"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout"
tools:ignore="MissingConstraints"
android:listSelector="@color/teal_200"
tools:layout_editor_absoluteX="0dp">
</ListView>
```
Also is there a way to change the checkbox icon from a tick to a star ?
| Keep the list view selected items ticked all the time | CC BY-SA 4.0 | null | 2021-03-25T17:15:42.430 | 2021-03-25T17:40:00.470 | null | null | 13,000,378 | [
"java",
"android",
"sqlite",
"listview",
"mobile-development"
] |
66,932,864 | 1 | 66,934,553 | null | 0 | 350 | I am developing in flutter a stock market alert app that checks in the background a certain stock price and send a push notification. I used the [background_fetch](https://pub.dev/packages/background_fetch) library but that is only able to fetch the price every 15 minutes, and have some reliability issues on ios.
Therefore, I was wondering if there was another way to implement the same feature.
| Sending push notification for background events in flutter | CC BY-SA 4.0 | null | 2021-04-03T15:31:34.697 | 2021-04-03T18:25:22.440 | null | null | 13,526,464 | [
"flutter",
"push-notification",
"background",
"mobile-development"
] |
66,969,884 | 1 | 66,971,486 | null | 1 | 98 | [This is what I'm trying to do. It works just fine in JavaScript but not in TS](https://i.stack.imgur.com/JAzbs.png)
```
export const Container = styled.View`
align-items: center;
`;
Container.Title = styled.Text`
font-family: Poppins-Regular;
color: #000000;
font-size: 20px;
`;
```
```
Property 'Title' does not exist on type 'StyledComponent<typeof View, DefaultTheme, {}, never>'.
```
| How can I add a StyledComponent as a property to a another StyledComponent in TypeScript? | CC BY-SA 4.0 | null | 2021-04-06T13:45:09.983 | 2021-04-06T15:17:45.347 | null | null | 13,667,463 | [
"typescript",
"react-native",
"styled-components",
"mobile-development",
"react-typescript"
] |
66,971,307 | 1 | 66,974,779 | null | 0 | 221 | I'm developing a flutter app which requires to run background task approximately every 5 minutes. To achieve this I tried using libraries like [background_fetch](https://pub.dev/packages/background_fetch) doing everything within the phone, but it doesn't fit my needs. I wonder if there was a server way to silently awake the app every 5 minutes, even for a short period of time in order to execute the needeed piece of code
| Periodically awaking a flutter app from server | CC BY-SA 4.0 | null | 2021-04-06T15:07:57.333 | 2021-04-06T18:52:58.623 | null | null | 13,526,464 | [
"flutter",
"background",
"mobile-development"
] |
67,057,352 | 1 | null | null | 0 | 1,513 | I'm new in react native development and using expo-cli. I add a react-native-table-component its working fine but now I'm calling API but I'm facing that error
> object.entries requires that input parameter not be null or undefined react native
Table is created by for loop dynamically. As you see in the below code:
```
import React, {useEffect, useState} from 'react';
import { StyleSheet, View,Text, ScrollView } from 'react-native';
import { Table, TableWrapper, Row } from 'react-native-table-component';
import Constants from 'expo-constants';
import Header from './header';
import axios from 'react-native-axios';
const AllData = ({navigation}) => {
const [dataCSV, setData] =useState([]);
const pressHandler = ()=>{
navigation.toggleDrawer();
}
useEffect(()=>{
loadData();
},[])
const loadData = async () =>{
const result = await axios.get("https://hebruapp.herokuapp.com/api/hebru/");
setData(result.data);
}
const state = {
tableHead: ['שם_מכשיר', 'מספר_סידורי', 'סטטוס', 'גרסת_תוכנה', 'תוכנה', 'מודל', 'גרסת_קושחה', 'הגדרות_תקשורת', 'קוד_איתחול_פינפד','מספר_מסוף','מספר_מסוף',
'מספר_מוטב',
'מספר_קופה',
'שם_בית_העסק',
'מספר_עוסק',
'מספר_עוסק_בסליקה',
'סניף',
'משווק',
'תאריך_הקמה',
'תאריך_גישה_אחרונה_למערכת',
'איש_קשר',
'טלפון_איש_קשר',
'כתובת_מלא'],
widthArr: [40, 60, 80, 100, 120, 140, 160, 180, 200,180,180,180,180,180,180,180,180,180,180,180,180,180,]
}
const tableData = [];
for (let i = 0; i < 30; i += 1) {
const rowData = [];
for (let j = 0; j < 22; j += 1) {
for (let [key, value] of Object.entries(dataCSV[j])) {
rowData.push(`${value}`);
}
}
tableData.push(rowData);
}
return (
<View>
<Header onPress={pressHandler} title="All Data" />
<View style={styles.containerDatatable}>
<ScrollView horizontal >
<View>
<Table borderStyle={{borderWidth: 1, borderColor: '#C1C0B9'}}>
<Row data={state.tableHead} widthArr={state.widthArr} style={styles.header} textStyle={styles.text}/>
</Table>
<ScrollView style={styles.dataWrapper}>
<Table borderStyle={{borderWidth: 1, borderColor: '#C1C0B9'}}>
{
tableData.map((rowData, index) => (
<Row
key={index}
data={rowData}
widthArr={state.widthArr}
style={[styles.row, index%2 && {backgroundColor: '#F7F6E7'}]}
textStyle={styles.text}
/>
))
}
</Table>
</ScrollView>
</View>
</ScrollView>
</View>
</View>
)
}
const styles = StyleSheet.create({
containerDatatable: { padding: 16, paddingTop: 10, backgroundColor: '#fff' },
header: { height: 50,backgroundColor: "radial-gradient(ellipse at left bottom, rgb(163, 237, 255) 0%, rgba(57, 232, 255, 0.9) 59%, rgba(48, 223, 214, 0.9) 100% )", },
text: { textAlign: 'center', fontWeight: '100' },
dataWrapper: { marginTop: -1 },
row: { height: 40, backgroundColor: '#E7E6E1' },
dataHeading:{textAlign:'center', fontWeight:'bold', marginBottom:10}
});
export default AllData;
```
[](https://i.stack.imgur.com/OlJ9C.png)
The error I'm facing on this
```
for (let [key, value] of Object.entries(dataCSV[j]))
```
line when I pass the index value of j `dataCSV[j]`.
How can I get rid of this problem?
| object.entries requires that input parameter not be null or undefined react native? | CC BY-SA 4.0 | null | 2021-04-12T11:13:23.220 | 2021-04-12T19:33:06.200 | 2021-04-12T19:33:06.200 | 4,420,967 | 13,104,584 | [
"javascript",
"reactjs",
"react-native",
"object",
"mobile-development"
] |
67,137,592 | 1 | null | null | 0 | 90 | Thanks for giving time to read this question and help me.
I have a SideDrawer in my home screen having two options. If I click on 'Tickets' I want Flutter to produce a new page with the tickets.
But, this doesn't seem to be the case. Whenever i tap on 'Tickets', nothing loads. I am pretty sure the function userData() does execute, but doesn't load the new page.
| Flutter not producing a screen | CC BY-SA 4.0 | null | 2021-04-17T11:23:30.803 | 2021-05-10T05:24:10.913 | 2021-05-10T05:24:10.913 | null | null | [
"android",
"flutter",
"flutter-dependencies",
"mobile-development",
"flutter-design"
] |
67,146,319 | 1 | null | null | 0 | 411 | Hy, I'm new in react-native. I'm trying to my CSV file into formdata using . But it's confusing or not work according to me.
The app I'm trying to create already created for the web in reactJS.
Here code of web(reactJS) is working :
```
let formData = new FormData();
formData.append("file", csvFile);
```
and button is:
```
<Form.File>
<Form.File.Input
accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
type="file"
component="span"
onChange={handleFile}
name="file"
/>
</Form.File>
```
In react, we append the file it's saved in , which is the value of the name attribute in the button.
Now in react native I try this something like this:
```
let result = await DocumentPicker.getDocumentAsync({type: "text/csv"});
const dataFile ={
"file":result
}
let formData = new FormData();
formData.append("file", dataFile);
```
```
<TouchableOpacity>
<Button title="upload your file" color="black" onPress={pickDocument} />
</TouchableOpacity>
```
I use to get the file. But according to me, there is no props name for the button in react-native.
Now question is that how I can formdata.append() it. like web do in web
| Want to convert CSV File into Formdata in react native | CC BY-SA 4.0 | null | 2021-04-18T07:57:52.547 | 2021-04-18T07:57:52.547 | null | null | 13,104,584 | [
"javascript",
"reactjs",
"react-native",
"form-data",
"mobile-development"
] |
67,156,498 | 1 | null | null | 0 | 1,574 | I don't understand what the issue is first I'm using react-native-drawer v4 but after I'm trying to use '@react-navigation/drawer' v5 but it's not working. Someone who can help me with what mistake I'm doing.
I'm using expo-CLI for the react-native app.
Reason to move on v5 I feel easy to add custom button or options because I don't found who to add custom drawer option in v4.
```
import React from 'react';
// import { createDrawerNavigator, DrawerContentScrollView, DrawerItemList, DrawerItem, } from 'react-navigation-drawer';
import {createDrawerNavigator,DrawerContentScrollView,DrawerItemList, DrawerItem,} from '@react-navigation/drawer';
const AuthNavigation = createDrawerNavigator({
Login:{screen:Login},
});
function CustomDrawerContent(props) {
return (
<DrawerContentScrollView {...props}>
<DrawerItemList {...props} />
<DrawerItem label="logout" onPress={() => alert('Link to help')} />
</DrawerContentScrollView>
);
}
const Drawer = createDrawerNavigator();
function MyDrawer() {
return (
<Drawer.Navigator drawerContent={props => <CustomDrawerContent {...props} />}>
<Drawer.Screen name="Users" component={AllUsers} />
<Drawer.Screen name="Data" component={AllData} />
<Drawer.Screen name="Add User" component={AddUser} />
<Drawer.Screen name="Uploader" component={UploadFile} />
</Drawer.Navigator>
);
}
// const AppNavigation = createDrawerNavigator({
// Add_User:{
// screen: AddUser,
// navigationOptions:{
// drawerLabel: 'Add User',
// }
// },
// Data:{screen: AllData},
// Users:{screen: AllUsers},
// Uploader:{screen: UploadFile},
// })
const AuthLoadScreen = ({navigation}) =>{
const _loadData= async ()=>{
const isLoggedIn = await AsyncStorage.getItem('isLoggedIn');
navigation.navigate(isLoggedIn !== '1' ? 'Auth':'App' );
}
_loadData();
return(
<View>
<ActivityIndicator/>
<StatusBar barStyle="default" />
</View>
);
}
export default createAppContainer(createSwitchNavigator(
{
AuthLoading:AuthLoadScreen,
App:MyDrawer,
Auth:AuthNavigation
},{
initialRouteName: 'AuthLoading'
}
));
```
| TypeError: (0, _native.createNavigatorFactory) is not a function | CC BY-SA 4.0 | null | 2021-04-19T05:41:20.350 | 2021-05-03T18:57:40.607 | null | null | 13,104,584 | [
"android",
"reactjs",
"react-native",
"react-native-navigation",
"mobile-development"
] |
67,227,448 | 1 | null | null | 0 | 54 | I am currently working on a remote styling feature. Cannot find a way how to change colorPrimary value after the activity is created and the remote style is downloaded via the API. I know that the theme styling is immutable and that value cannot be changed, but I believe there is a way to to tell all the Material components, status bar and menu bar to use a specific colours after is it ready to use. Any ideas?
Attaching my theme code:
```
<style name="OrderingTheme" parent="@style/Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
```
Thanks!
| How to change theme colours in a run-time | CC BY-SA 4.0 | null | 2021-04-23T09:30:54.257 | 2022-08-10T05:16:23.117 | null | null | 9,161,815 | [
"android",
"api",
"styles",
"customization",
"mobile-development"
] |