я хочу поменять эти сообщения с одного на нижний, - PullRequest
0 голосов
/ 04 июня 2018

Мне нужна помощь в этом случае, я пытаюсь передать широковещательное сообщение своим клиентам. Это означает, что я хочу отправлять свои входные данные пользователю только в форме сообщений и не хочу получать от них информацию.Итак, что я сделал, я использую облачные сообщения для своего проекта, теперь я могу использовать входные данные и отображать их в моем текстовом представлении.Но теперь я хочу сохранить это и поменять его построчно, я хочу показать свои сообщения только их, также я хочу показать только мои последние 10 сообщений, поэтому последующая часть будет бесполезной, я попытался поменять местами, но это не такработая в моем графике.

Я покажу свою активность здесь

MainActivity.java

package com.intraday.geeks;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.iid.FirebaseInstanceId;

public class MainActivity extends AppCompatActivity {
    private FirebaseAuth mAuth;



    private static final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mAuth=FirebaseAuth.getInstance();


        TextView textView1 =(TextView)findViewById(R.id.callOne);
        TextView textView2 =(TextView)findViewById(R.id.CallTwo);
        TextView textView3 =(TextView)findViewById(R.id.callThree);
        TextView textView4 =(TextView)findViewById(R.id.callFour);
        TextView textView5 =(TextView)findViewById(R.id.callFive);
        TextView textView6 =(TextView)findViewById(R.id.callSix);
        TextView textView7 =(TextView)findViewById(R.id.callSeven);
        TextView textView8 =(TextView)findViewById(R.id.CallEight);


        if(getIntent().getExtras()!=null){
            for(String key : getIntent().getExtras().keySet())
            {
                if (key.equals("a")){
                    textView1.setText(getIntent().getExtras().getString(key));
                    String variable1 = textView1.getText().toString();



                }
            }


        }



    }



    @Override
    public void onStart() {
        super.onStart();



        FirebaseUser currentUser = mAuth.getCurrentUser();
        if (currentUser==null){
            Intent authIntent = new Intent(MainActivity.this, Login.class);
            startActivity(authIntent);
            finish();
        }
    }
}

activity_main

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:background="#5d1b8f"
    android:orientation="vertical"

    android:layout_height="match_parent"
    tools:context="com.intraday.geeks.MainActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:id="@+id/callOne"
        android:layout_width="fill_parent"
        android:layout_height="75dp"
        android:background="#dc2619"
        android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
        style="@style/Base.AlertDialog.AppCompat"
        android:textSize="20dp"
        android:textColor="#ffff"
        />

    <TextView
        android:id="@+id/CallTwo"
        android:layout_width="fill_parent"
        android:textSize="20dp"
        android:layout_height="75dp"
        android:textColor="#ffff"
        android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
        style="@style/Base.AlertDialog.AppCompat">

    </TextView>

    <TextView
        android:id="@+id/callThree"
        android:layout_width="fill_parent"
        android:textSize="20dp"
        android:background="#dc2619"
        android:layout_height="75dp"
        android:textColor="#ffff"
        android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
        style="@style/Base.AlertDialog.AppCompat">

    </TextView>

    <TextView
        android:id="@+id/callFour"
        android:layout_width="fill_parent"
        android:layout_height="75dp"
        android:textColor="#ffff"
        android:textSize="20dp"
        android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
        style="@style/Base.AlertDialog.AppCompat">

    </TextView>

    <TextView
    android:id="@+id/callFive"
    android:layout_width="fill_parent"
    android:layout_height="75dp"
    android:textColor="#ffff"
        android:background="#dc2619"
        android:textSize="20dp"
    android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
    style="@style/Base.AlertDialog.AppCompat">

</TextView>


    <TextView
        android:id="@+id/callSix"
        android:layout_width="fill_parent"
        android:layout_height="75dp"
        android:textColor="#ffff"

        android:textSize="20dp"
        android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
        style="@style/Base.AlertDialog.AppCompat">

    </TextView>


    <TextView
        android:id="@+id/callSeven"
        android:layout_width="fill_parent"
        android:layout_height="75dp"
        android:textColor="#ffff"
        android:textSize="20dp"
        android:background="#dc2619"
        android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
        style="@style/Base.AlertDialog.AppCompat">

    </TextView>

    <TextView
        android:id="@+id/CallEight"
        android:layout_width="fill_parent"
        android:layout_height="75dp"
        android:textColor="#ffff"
        android:textSize="20dp"
        android:text="Tips are only Available In Live Market 9:15Am to 3:15Pm"
        style="@style/Base.AlertDialog.AppCompat">

    </TextView>






</LinearLayout>

</ScrollView>
...