• Breaking News

    [Android][timeline][#f39c12]

    Saturday, August 10, 2019

    App Feedback Thread - August 10, 2019 Android Dev

    App Feedback Thread - August 10, 2019 Android Dev


    App Feedback Thread - August 10, 2019

    Posted: 10 Aug 2019 05:29 AM PDT

    This thread is for getting feedback on your own apps.

    Developers:

    • must provide feedback for others
    • must include Play Store, GitHub, or BitBucket link
    • must make top level comment
    • must make effort to respond to questions and feedback from commenters
    • may be open or closed source

    Commenters:

    • must give constructive feedback in replies to top level comments
    • must not include links to other apps

    To cut down on spam, accounts who are too young or do not have enough karma to post will be removed. Please make an effort to contribute to the community before asking for feedback.

    As always, the mod team is only a small group of people, and we rely on the readers to help us maintain this subreddit. Please report any rule breakers. Thank you.

    - Da Mods

    submitted by /u/AutoModerator
    [link] [comments]

    The developer-friendly guide to using App Bundles vs APK self-signing (may not agree with Google recommendations)

    Posted: 10 Aug 2019 11:45 AM PDT

    NOTE: Please point out any mistakes in the comments, and I will try to correct them.


    You should avoid App Bundles for first publication of a new app.

    If you do that, from what I understand, you will not get the key used to sign the APK - only Google will know it.

    The better strategy is to first publish the APK for a new app by the usual/old method (for this you will have to generate keystore file and password etc. for it). Once you have published it once like this, after that you can try the App Bundle method (now YOU will supply the key to Google so they can bundle as they please and sign it using the key you supplied - while being compatible with earlier published APK).

    The advantage of the second approach ie having control over key - is that if you publish an APK later on your website, your users will seamlessly be able to side-load using APK downloaded from your website.

    In contrast, if you don't know your key, and you just follow Google recommendations, and publish new app with App Bundle method, you will never know the real key that Google uses to create APKs. Later if you have trouble with Google - get banned by Google, or that app gets banned - you will then never be able to create an APK on your website for users to seamlessly update to (and to demonstrate it is a legitimate version).

    If the above is correct (please correct me if it wrong), then it is misleading for Google to advocate App Bundle method without informing of the caveats.

    How Google can fix this

    Now if tomorrow, Google updates the App Bundle method, so that dev gets a copy of the keystore/password that Google is using, then that will remove most of the negatives with the 'App Bundle method for new app' workflow.

    submitted by /u/stereomatch
    [link] [comments]

    Kinda missed out on the whole MVVM/Room/Jetpack/etc. train, where should I get started?

    Posted: 10 Aug 2019 12:50 AM PDT

    The last time I've done Android development was in early 2015. So basically I just woke up from a horrible coma, and everything's changed.

    I feel really lost because Android changed so much but I still want to get into it, with a fresh start.

    Basically I'm looking for resources and tutorials to get familiar with the "new" stuff. Can anyone point me to some useful ones? Anything would be appreciated.

    submitted by /u/Qayi
    [link] [comments]

    hiring someone from upwork with a suspended developer account.

    Posted: 10 Aug 2019 11:08 AM PDT

    hey I need someone to add somethings to my flutter app but his account got suspended should I still hire him ? I heard if I add him to my dev account I could get suspended? anyone have any advice on this situation ?

    submitted by /u/thatgirlsarah1284
    [link] [comments]

    Android Studio Annoyances

    Posted: 10 Aug 2019 01:14 PM PDT

    At some point Android Studio changed my CTRL+TAB behavior so that switching from the code editor to the layout editor (and clicking anywhere in the layout editor) and then back will put the cursor focus in my Project view and not back in the editor.

    For example if I am editing a file like FooFragment.kt and then I go to the inflated layout by CTRL+Clicking the id (R.id.fragment_foo) if I put the cursor anywhere in the layout editor and CTRL+TAB back to the FooFragment.kt I can't type where I left off.

    It's been like this for a couple versions and I haven't figured out how I would change it back. I'm on Windows and using AS 3.4.2. If anyone had some ideas on how to get back the old behavior it would save me from having to remember to hit escape or grab my mouse all the time.

    submitted by /u/jeffinmadison
    [link] [comments]

    Build story game

    Posted: 10 Aug 2019 04:18 PM PDT

    I'm fascinated about story games like: Sentece, Who's the killer, I'm innocent etc.

    How can is built this kind of game?

    I'm an android developer and I work in Android Studio, is there any solutions to build this kind of games using Android Studio?

    If this is possible, how?

    If not, what should I use, unity or what are best practices?

    submitted by /u/clauub
    [link] [comments]

    VMOS Virtual Android on Android - Double Your System

    Posted: 10 Aug 2019 12:09 PM PDT

    Run a VM (Virtual Machine) on your android smartphone.

    Have a secondary phone environment on your phone.

    Has root access via SuperSU and runs Android 5.1.1 {Lollipop} (90% app compatibility)

    Has full Google play services.

    Runs smooth on Samsung Galaxy S8+

    4gb of ram is the minimum.

    Also vmos gets root for any device that can't be rooted like Samsung via vm. So you can test your mods and try out root apps.

    To root your vm:

    Settings - - > about phone - - > tap build number tell it says you're a developer - - > go to developer settings (above about phone) - - > turn root on & reboot your vm

    Go to SuperSU app go to settings and make SuperSU apps only. Don't touch anything else.

    Now your vm has root access.

    Magisk will not work on your vm only SuperSU.

    Google Play download

    submitted by /u/Blood_Reaper
    [link] [comments]

    google associate ban

    Posted: 10 Aug 2019 03:42 PM PDT

    Hello guys I am developing an app and will publish it soon to the play store. I will be moving to the college's campus next next months.

    I have heard that if I use the same wifi network as some body who have been banned from google I could be banned too. When I move in I will be using the university's wifi which somebody who might have used it got banned from google. Is this real? should I be worried? Also are there any other dangers from using the university wifi to work on and publish app?

    submitted by /u/Abdummm
    [link] [comments]

    Is using a gridView a good approach for creating a chess app?

    Posted: 10 Aug 2019 02:27 AM PDT

    I decided as a personal project that I wanted to create a chess app.

    So I got to the point where I have a gridView with 63 black and white squares creating the board. And an overlapping gridView for the pieces. I have the starting points of the pieces set on the second gridView.

    My next step would probably be to create the Piece class and create rules and everything, but what I'm more concerned about is how to create some sort of game loop and reload the gridView after every move.

    Has anyone ever made a chess app? Did you use another approach? Any ideas?

    Thanks all.

    submitted by /u/That0neTurd
    [link] [comments]

    Best tutorial for creating a comrehensive log in system?

    Posted: 10 Aug 2019 02:36 PM PDT

    I've been searching for some time now and have yet to find a tutorial on creating an android app that has a consistent log in system for android. I've never done an app log in before and I am needing to create an app that has persistant log in and has compulsory log in on start up - if the user is not logged in already. I would be happy to do this as part of a wider 'android' tutorial, but I've found a surprising lack of comprehensive free android tutorials that have log ins completed, although maybe my googling is failing me.

    Many thanks if you know of anything and for any help you can provide. :)

    submitted by /u/rtgrdgdqwdssad
    [link] [comments]

    My app is more of a Website than an app! Any Suggestions for fixes?

    Posted: 10 Aug 2019 10:06 AM PDT

    Hi everyone,

    I am currently developing an app that teaches AP physics. The app is centered around compressing info into a study-able block that students can use to learn AP physics faster (the prerequisite is that they must have learned honors already).

    The current format of the app separates chunks of physics into days. So, upon entering the app there will be buttons for Days of learning. Each Day contains 8-11 pages of that info. For example, Day 5 might be electromagnetics but then be split into many pages of magnetism, currents, etc. Each page also has a button at the bottom that takes them to a page where they will be quizzed with about 3 or 4 MCQ/FRQ questions.

    I had several friends test this app, but they liked the information that I wrote, but all said it seemed more of a website than an app. They said that an app needs something more to it, although they couldn't think of what to add. I value their opinions and am ransacking my head to think of what more to add. I've seen other apps have fun gifs and fun features, but I've used them and they are too cluttered or detract from the information they are trying to tell me. I personally found those "fun" apps harder to learn from. My goal is to have the user be pushed to finish each day and then go onto the next in-app day the next day (kinda weird to say but you guys know what I mean). I realized that many people are distracted and procrastinate and I want to make an app that pushes them to finish what they have to study each day.

    Some ideas I thought of to help my app seem more of an app are: alarm notifications (to tell the user to start their in-app studying each day), smoother transitions in UI (maybe a transition screen between pages), click definitions (press a bolded word to find its definition).

    However, I see these ideas in many websites too, so please - any ideas would be very helpful.

    submitted by /u/IyatsuAQW
    [link] [comments]

    Clipboard configuration in android virtual device?

    Posted: 10 Aug 2019 01:08 PM PDT

    When long pressing in a textfield some Samsung devices offer the possibility to "Paste" and "Clipboard".

    I was wondering if its possible to replicate this in android studio by using a skin provided by Samsung? I have tried so far (only download the skin and configured in AVD)

    submitted by /u/gambo1914
    [link] [comments]

    GeoFire read ops efficiency

    Posted: 10 Aug 2019 12:17 PM PDT

    I'm using geofire to query Firestore as a user walks around. Here's my question:

    Let's say my Firestore database has 5000 geohashed records in it and they're randomly located around the world. The records are all stored off a root node. When I execute a geofire query with a very small radius, which of these is happening (assuming the default geofire params):

    Option 1: the 1st geoquery generates 5000 billable firebase read ops as it searches all 5000 keys for matches. Each geoquery thereafter (from the same location or different location) uses a cached copy of the 5000 keys and does not generate billable read ops.

    Option 2: every geoquery generates a new 5000 billable firebase read ops, regardless of whether the geoquery centerpoint or radius changes

    Option 3: something else entirely!

    submitted by /u/ImHiiiiiiiiit
    [link] [comments]

    The Definitive Guide to App Links

    Posted: 10 Aug 2019 08:22 AM PDT

    Is there a way to mark your app as unofficial so it won’t be suspended for impersonation?

    Posted: 10 Aug 2019 11:34 AM PDT

    I see tons of apps on the Play Store that "impersonate" other video games, movies, etc. There are countless guide apps and such that aren't taken down, but when I try to create an app for a video game it gets taken down for impersonation. How do so many other people get away with it?

    submitted by /u/vandjac
    [link] [comments]

    Nav bar

    Posted: 10 Aug 2019 02:04 PM PDT

    Nav bar doesn't fade like on previous builds to prevent screen burn in

    submitted by /u/brentydan
    [link] [comments]

    HID device suffering disconnections due to battery optimization.

    Posted: 10 Aug 2019 07:46 AM PDT

    Hi all. My app interfaces with a power hungry HID device but I do not need the phone to power the device. Is there any way to stop power and keep only data?

    The problem I'm having is that some aggressive battery saving features(mostly on Samsung phones) kill the connection. Only way round at the moment is to prompt the user to remove my app from the optimization list.

    submitted by /u/r4v3rrr
    [link] [comments]

    Displaying Compilation Issues Before actually compiling?

    Posted: 10 Aug 2019 07:05 AM PDT

    Can my app have IAP tokens that can be exchange for lives in a betting app?

    Posted: 10 Aug 2019 06:56 AM PDT

    The thing is I always thought that this was forbidden until I saw one app called quizdom, they offer games where you can earn money and if you lose you can refill your lives with 1$

    submitted by /u/joseluiselp2
    [link] [comments]

    should I Implement Firebase Authentication ( Facebook , Google sign up ) into my app ?

    Posted: 10 Aug 2019 03:44 AM PDT

    I am not really familiar with it , I am not sure if is the best thing to do or not , all what I know is Implement it will make it easier for the users to sign up

    so can you guys tell me you opinion on it ?

    and is there something I should know before I put it to my app

    Thanks

    submitted by /u/mghol
    [link] [comments]

    Why devs use Retrofit, not Fuel?

    Posted: 09 Aug 2019 07:39 PM PDT

    I was wondering why most folks use Retrofit, not Fuel ?

    Several of reasons, I could think of using Retrofit

    • Being here for while (Stability), by the way Fuel also in 2.x
    • Developed by Square
    • Have lot of resources

    Are not there any advantages of using Fuel over Retrofit with Kotlin?

    submitted by /u/nerdy_adventurer
    [link] [comments]

    Any idea to stop multiautocompletetextview on Android on second try?

    Posted: 10 Aug 2019 03:04 AM PDT

    how i stop the add on two time (autocomplete..?)

    • e.g.: Java JavaScript. (and then stop the multiautocomplete)
    • e.g.:Java 10SQL. (and the stop the multiautocomplete)

    @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); multiAutoCompleteTextViewCustom = findViewById(R.id.multiAutoCompleteTextViewCustom); ArrayAdapter<String> tagArray = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, tags); multiAutoCompleteTextViewCustom.setAdapter(tagArray); multiAutoCompleteTextViewCustom.setThreshold(2); multiAutoCompleteTextViewCustom.setTokenizer(new SpaceTokenizer()); } 
    submitted by /u/hackertomobile
    [link] [comments]

    A view has a Parent in Android ( LOL on Complication )

    Posted: 10 Aug 2019 01:08 AM PDT

    Intent putExtra and Bundle returning null [HELP REQUIRED]

    Posted: 10 Aug 2019 06:26 AM PDT

    Hi,

    I am working on a tinder style project but for mentoring that involves sending information to and from a local postgres database. To do this I have a client and server class. The way it works is that I use a global Client class variable which is initialised in the LoginActivity. I have called this variable clientLoggedIn. Within the Client class I have created a method to set the context of the application and a messageToServer method which sends messages to the server. I have also created a informationReciever inner class in the client which recieves information from the server and based on the message sent by the server, the ActivityOpener inner class opens the necessary activity.

    The code works fine within the activityOpener inner class for the Profile Activity which is the activity that is started when the user logs in. This has 2 fragments within it (the ProfileFragment and the EditProfileFragment). Send intents from the ActivityOpener inner class to both of these fragments using the global variable works and I had no issues loading the user data using intents to set the Profile information in ProfileFragment or updating the user profile information through EditProfileFragment. I am having issues however with the code below this line in the ActivityOpener inner class:

     if(messageFromServer[0].equals("matcheslist")){ 

    The code below this line is called when a separate activity called MatchesActivity is created. Within this are fragments also. 1 of the fragments is called MatchesFragment. I am trying to send the data received from the server by the client to this MatchesFragment. The data from the server is in the form of a string array and it contains the user details of people who are of usertype 'Mentor'. I did try to convert it to a arraylist<String> to send the information received from the server using a bundle to the MatchFragment however this kept returning a null pointer exception and even after following everything I could find online it did not work. So I tried to use intent.putExtra(key, String) as I did for the ProfileActivity fragments to see if this would work. However this still returned a null value even though for ProfileActivity fragments it works. I have attached the code below for the Client class, MatchFragment and LoginActivity which is where the global variable is initialised. I did try using a singleton rather than a global variable for Client class too, however that was not working which is why I went with using a global variable.

    I am short on time for the deadline due to having had issues setting up the client and server which took longer than expected to get working, I would really really appreciate any help at all with doing this please.

    Client class

     public class Client extends Application { Socket socket; ObjectOutputStream clientSentMessageToServer; ObjectInputStream clientMessageFromServer; // ADDED >> private static Client instance = null; // <<ADDED private Context context; // public Client(String[] message){ public Client(String host, int port) { String[] messageFromServer; try { socket = new Socket(host, port); // sending information to server clientSentMessageToServer = new ObjectOutputStream(socket.getOutputStream()); // clientSentMessageToServer.writeObject(message); clientMessageFromServer = new ObjectInputStream((socket.getInputStream())); InformationReceiver informationReceiver = new InformationReceiver(clientMessageFromServer); informationReceiver.start(); } catch (IOException e) { e.printStackTrace(); } } // public static Client getInstance(){ // // if(instance == null){ // instance = new Client("10.0.2.2", 9999); // } // return instance; // } // // public Context getContext(){ // return context; // } public void setContext(Context context){ this.context = context; } public Context getContext(){ return context; } public void messageToServer(String[] message) throws IOException { clientSentMessageToServer.writeObject(message); } private class InformationReceiver implements Runnable { private Thread t; private ObjectInputStream clientMessageFromServer; public InformationReceiver(ObjectInputStream objectInputStream) { this.clientMessageFromServer = objectInputStream; } public void run() { boolean running = true; while (running) { try { String[] infoFromServer = (String[]) clientMessageFromServer.readObject(); ActivityOpener activityOpener = new ActivityOpener(context, infoFromServer); activityOpener.start(); } catch (IOException e) { running = false; } catch (ClassNotFoundException e) { e.printStackTrace(); } } } public void start() { if (t == null) { t = new Thread(this); t.start(); } } } public class ActivityOpener implements Runnable { private Thread t; private String[] messageFromServer; private Context context; public ActivityOpener(Context context, String[] messageFromServer) { this.messageFromServer = messageFromServer; this.context = context; } @Override public void run() { if (messageFromServer[0].equals("Registration successful")) { // https://www.codota.com/code/java/methods/android.app.Activity/runOnUiThread to get activity.runOnUIThread working ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, "Hello world! is the message", Toast.LENGTH_LONG).show(); context.startActivity(new Intent(context, LoginActivity.class)); } }); } if (messageFromServer[0].equals("Error")) { ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, "Error, please make sure passwords match and all details are selected", Toast.LENGTH_LONG).show(); } }); } if (messageFromServer[0].equals("logged in")) { if (messageFromServer[6].equals("Mentor")) { // open mentor interfaces instead ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, "Mentor logged in", Toast.LENGTH_LONG).show(); } }); } // https://www.codota.com/code/java/methods/android.app.Activity/runOnUiThread to get activity.runOnUIThread working if (messageFromServer[6].equals("Mentee")) { ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, "logged in is the message", Toast.LENGTH_LONG).show(); Intent intent = new Intent(context, ProfileActivity.class); intent.putExtra("userid", messageFromServer[1]); intent.putExtra("firstname", messageFromServer[2]); intent.putExtra("lastname", messageFromServer[3]); intent.putExtra("gender", messageFromServer[4]); intent.putExtra("about", messageFromServer[5]); intent.putExtra("usertype", messageFromServer[6]); intent.putExtra("pref1", messageFromServer[7]); intent.putExtra("pref2", messageFromServer[8]); intent.putExtra("pref3", messageFromServer[9]); intent.putExtra("pref4", messageFromServer[10]); intent.putExtra("hob1", messageFromServer[11]); intent.putExtra("hob2", messageFromServer[12]); intent.putExtra("hob3", messageFromServer[13]); intent.putExtra("hob4", messageFromServer[14]); intent.putExtra("personality", messageFromServer[15]); context.startActivity(intent); } }); } } if (messageFromServer[0].equals("updated user")) { if (messageFromServer[6].equals("Mentor")) { //send intent to mentor activity interface instead } if (messageFromServer[6].equals("Mentee")) { // send intent to mentee activity interface instead to update mentee profile details ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, "Your profile details have been upated", Toast.LENGTH_LONG).show(); Intent intent = new Intent(context, ProfileActivity.class); intent.putExtra("userid", messageFromServer[1]); intent.putExtra("firstname", messageFromServer[2]); intent.putExtra("lastname", messageFromServer[3]); intent.putExtra("gender", messageFromServer[4]); intent.putExtra("about", messageFromServer[5]); intent.putExtra("usertype", messageFromServer[6]); intent.putExtra("pref1", messageFromServer[7]); intent.putExtra("pref2", messageFromServer[8]); intent.putExtra("pref3", messageFromServer[9]); intent.putExtra("pref4", messageFromServer[10]); intent.putExtra("hob1", messageFromServer[11]); intent.putExtra("hob2", messageFromServer[12]); intent.putExtra("hob3", messageFromServer[13]); intent.putExtra("hob4", messageFromServer[14]); intent.putExtra("personality", messageFromServer[15]); context.startActivity(intent); } }); } } if(messageFromServer[0].equals("matcheslist")){ int noOfStringsToAdd = messageFromServer.length - 1; final String[] matchesMessageFromServer = new String[noOfStringsToAdd]; int i = 1; while(i<noOfStringsToAdd){ matchesMessageFromServer[i] = messageFromServer[1]; } ((Activity) context).runOnUiThread(new Runnable() { @Override public void run() { Intent intent =new Intent(context, MatchesActivity.class); intent.putExtra("userid", messageFromServer[1]); intent.putExtra("firstname", messageFromServer[2]); intent.putExtra("lastname", messageFromServer[3]); intent.putExtra("gender", messageFromServer[4]); intent.putExtra("about", messageFromServer[5]); intent.putExtra("usertype", messageFromServer[6]); intent.putExtra("pref1", messageFromServer[7]); intent.putExtra("pref2", messageFromServer[8]); intent.putExtra("pref3", messageFromServer[9]); intent.putExtra("pref4", messageFromServer[10]); intent.putExtra("hob1", messageFromServer[11]); intent.putExtra("hob2", messageFromServer[12]); intent.putExtra("hob3", messageFromServer[13]); intent.putExtra("hob4", messageFromServer[14]); intent.putExtra("personality", messageFromServer[15]); context.startActivity(intent); // final List<String[]> matchesList = new ArrayList<>(); // // int noOfMatches = (messageFromServer.length - 1)/14; // int i = 0; // // String[] mentorToAdd; // int stringArrayPos = 1; // while(i < noOfMatches){ // mentorToAdd = new String[]{messageFromServer[stringArrayPos], //messageFromServer[stringArrayPos+1], messageFromServer[stringArrayPos+2], //messageFromServer[stringArrayPos + 3], messageFromServer[stringArrayPos + 4], //messageFromServer[stringArrayPos + 5], messageFromServer[stringArrayPos + 6], //messageFromServer[stringArrayPos + 7], messageFromServer[stringArrayPos + 8], //messageFromServer[stringArrayPos + 9], messageFromServer[stringArrayPos + 10], //messageFromServer[stringArrayPos + 11], messageFromServer[stringArrayPos + 12], //messageFromServer[stringArrayPos + 13]}; // stringArrayPos += 14; // // matchesList.add(mentorToAdd); // } // final ArrayList<String> matchesList = new ArrayList<String>(); // // int noOfStringsToAdd = messageFromServer.length - 1; // // int i = 1; // // while(i<noOfStringsToAdd){ // matchesList.add(messageFromServer[i]); // i++; // } // Bundle b = new Bundle(); // b.putStringArray("matcheslist", matchesMessageFromServer); //// intent.putStringArrayListExtra("matches list", matchesList); // intent.putExtras(b); } }); } } public void start() { if (t == null) { t = new Thread(this); t.start(); } } } } 

    Swipe fragment class

    public class SwipeFragment extends Fragment { private ArrayList<String> al; private ArrayAdapter<String> arrayAdapter; private int i; private Intent recievedIntent; public SwipeFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { MatchesActivity activity = (MatchesActivity) getActivity(); View rootView = inflater.inflate(R.layout.fragment_swipe, container, false); LoginActivity.clientLoggedIn.setContext(SwipeFragment.this.getContext()); // calls method to get matches list from server; try { getMatchesList(); } catch (IOException e) { e.printStackTrace(); } recievedIntent = activity.getIntent(); String matchName = recievedIntent.getStringExtra("firstname"); Log.i("SwipeFragment", matchName + ""); // Bundle b = recievedIntent.getExtras(); // String[] matchesArray = b.getStringArray("matcheslist"); // // if(b != null){ // Log.i("SwipeFragment", matchesArray.length + ""); // } // String[] matchesArray = b.getStringArray("matcheslist"); // Log.i("SwipeFragment", matchesArray.length + ""); // ArrayList<String> matchesArrayList = new ArrayList<>(); // // get the intent from client // matchesArrayList = recievedIntent.getStringArrayListExtra("matches list"); // Log.i("SwipeFragment", matchesArrayList.toString() + ""); // int noOfMatches = matchesArrayList.size()/14; al = new ArrayList<>(); al.add("php"); al.add("c"); al.add("python"); al.add("java"); al.add("html"); al.add("c++"); al.add("css"); al.add("javascript"); arrayAdapter = new ArrayAdapter<>(SwipeFragment.this.getActivity(), R.layout.item, R.id.helloText, al ); SwipeFlingAdapterView flingContainer = (SwipeFlingAdapterView) rootView.findViewById(R.id.frame); flingContainer.setAdapter(arrayAdapter); flingContainer.setFlingListener(new SwipeFlingAdapterView.onFlingListener() { @Override public void removeFirstObjectInAdapter() { // this is the simplest way to delete an object from the Adapter (/AdapterView) Log.d("LIST", "removed object!"); al.remove(0); arrayAdapter.notifyDataSetChanged(); } @Override public void onLeftCardExit(Object dataObject) { //Do something on the left! //You also have access to the original object. //If you want to use it just cast it (String) dataObject Toast.makeText(SwipeFragment.this.getActivity(), "left", Toast.LENGTH_SHORT).show(); } @Override public void onRightCardExit(Object dataObject) { Toast.makeText(SwipeFragment.this.getActivity(), "right", Toast.LENGTH_SHORT).show(); } @Override public void onAdapterAboutToEmpty(int itemsInAdapter) { // Ask for more data here al.add("XML ".concat(String.valueOf(i))); arrayAdapter.notifyDataSetChanged(); Log.d("LIST", "notified"); i++; } @Override public void onScroll(float scrollProgressPercent) { } }); // Optionally add an OnItemClickListener flingContainer.setOnItemClickListener(new SwipeFlingAdapterView.OnItemClickListener() { @Override public void onItemClicked(int itemPosition, Object dataObject) { Toast.makeText(SwipeFragment.this.getActivity(), "click", Toast.LENGTH_SHORT).show(); } }); // Inflate the layout for this fragment return rootView; } // sends message to server to send mentor matches list public void getMatchesList() throws IOException { String[] messageToSend = new String[1]; messageToSend[0] = "send matches"; LoginActivity.clientLoggedIn.messageToServer(messageToSend); } } 

    LoginActivity class where the Client global variable is first initialised

    public class LoginActivity extends AppCompatActivity { EditText mTextUsername; EditText mTextPassword; Button mButtonLogin; Spinner spinnerUserType; public static Client clientLoggedIn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_login); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); mTextUsername = findViewById(R.id.emailEditTextLogin); mTextPassword = findViewById(R.id.passwordEditTextLogin); mButtonLogin = findViewById(R.id.loginButtonLoginActivity); spinnerUserType = findViewById(R.id.spinnerUserType); ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.usertype, R.layout.support_simple_spinner_dropdown_item); spinnerUserType.setAdapter(adapter); spinnerUserType.setPrompt("Select user type"); } public void onLogin(View view) throws IOException { clientLoggedIn = new Client("10.0.2.2", 9999); String usernameText = mTextUsername.getText().toString().trim(); String passwordText = mTextPassword.getText().toString().trim(); String userTypeText = spinnerUserType.getSelectedItem().toString().trim(); String[] messageToSend = {"login", usernameText, passwordText, userTypeText}; clientLoggedIn.setContext(this); clientLoggedIn.messageToServer(messageToSend); } @Override public void finish() { super.finish(); } public static Intent newIntent(Context context){ Intent intent = new Intent(context, LoginActivity.class); return intent; } } 
    submitted by /u/DevotedToMotivation
    [link] [comments]

    No comments:

    Post a Comment

    Fashion

    Beauty

    Travel