Creating a Simple user Interface in Android Applications.

Creating a Simple user Interface in Android Applications.

Creating a Simple user Interface in Android Applications.
In my previsions lesson,we learnt how to pass variables from one activity to another.Today we are going to learn create a simple user interface using Linearlayout.
Android Projects defines resource layout.Layout xml contains all the elements that are contained in a application.These are the buttons,textfields,etc.

Resource String xml contains all the string that have been used in the application.For example the application name,button name Edittext hint message etc.

Creating Linearlayout

Open your activity_layout.xml file and add below code.
[
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout   
 xmlns:android="http://schemas.android.com/apk/res/android" 
   xmlns:tools="http://schemas.android.com/tools"   
 android:layout_width="match_parent"   
 android:layout_height="match_parent"  
  android:orientation="vertical">
]

Above code creates LinearLayout.width and height are matched depending on the device screen size.


Adding Button and TextField.

[
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"   
 android:layout_height="match_parent"  
  android:orientation="vertical">

    <EditText   
     android:id="@+id/enter_message"
        android:layout_width="match_parent"    
    android:layout_height="wrap_content"       
 android:hint="@string/edit_message" />

    <Button     
   android:layout_width="match_parent"   
    android:layout_height="wrap_content" 
       android:text="@string/button_send" />

</LinearLayout>
]

Looking at above code,we have created a EditText view and name it enter_message.Getting content from EditText View we need to  findViewById.

Error may appear because we have not created string resources.So let go ahead and create
string resources.

Adding String Resources

Below code creates all the string resources used in the application;
[
<resources>
    <string name="app_name">Gym Trainer</string>
    <string name="edit_message">Enter Message</string>
    <string name="button_send">Send</string>
]

MainActivity Java Class Code

This is the class that starts the application to run.
[
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;



public class MainActivity extends AppCompatActivity {

    public final static String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
    public final  static  String EXTRA_NAME="com.example.myfirstapp.NAME";
    public final  static  String EXTRA_EMAIL="com.example.myfirstapp.EMAIl";

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

    }
    //This method will be called once the user clicks send message button
}
]



COMMENTS

Name

android android Apps android emulators antivirus blogger bluestack Break Statement in Java constructors download downloader drivers emulators java java control statements java do-while loop java for loop java infinitive do-while loop java system methods java tutorials Java While Loop java.awt java.swing javalookandfeel javascript JButton JCheckBox JColorChooser JComboBox JDialog JFileChooser JFrame JLayeredPane JList JMenuBar joomla JOptionPane JPanel JPasswordField JPopupMenu JProgressBar JRadioButton JScrollBar JSlider JSpinner JTabbedPane JTable JTextArea JTextField JToolBar mysql php plugins Polymorphism setToolTiptext skype for windows software swing class themes Visual Studio Code WeChat whatsapp wordpress
false
ltr
item
Java Codes: Creating a Simple user Interface in Android Applications.
Creating a Simple user Interface in Android Applications.
Creating a Simple user Interface in Android Applications.
https://1.bp.blogspot.com/-_YOrHecHNJ8/WJRM8VybGeI/AAAAAAAAGy4/gVGwT5pR0KoR8j8ro6hSe-eYZF7zOZ7XgCLcB/s200/Creating%2Ba%2BSimple%2Buser%2BInterface%2Bin%2BAndroid%2BApplications.-min.PNG
https://1.bp.blogspot.com/-_YOrHecHNJ8/WJRM8VybGeI/AAAAAAAAGy4/gVGwT5pR0KoR8j8ro6hSe-eYZF7zOZ7XgCLcB/s72-c/Creating%2Ba%2BSimple%2Buser%2BInterface%2Bin%2BAndroid%2BApplications.-min.PNG
Java Codes
http://www.download-all.net/2017/02/creating-simple-user-interface-in.html
http://www.download-all.net/
http://www.download-all.net/
http://www.download-all.net/2017/02/creating-simple-user-interface-in.html
true
7826648292785071009
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy