Hereby you can learn how to make app using foreign language.
I am producing the technical details for Hindi. This is xml code that you have
to write on XML activity.
XML code
If your list of content is too much and not showing properly on one window then,
<?xml version="1.0"encoding="utf-8"?><RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_second2_list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.faraz.poetryapp.Second2ListView">
<ListView
android:id="@+id/ListView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
tools:context=".Second2ListView" />
</RelativeLayout>
If your list of content is too much and not showing properly on one window then,
you can use scroll view option like
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/activity_second2_list_view" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.faraz.poetryapp.Second2ListView"> <ScrollView android:id="@+id/SCROLLER_ID02" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" android:fillViewport="true"> <ListView android:id="@+id/ListView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" tools:context=".Second2ListView" /> </ScrollView> </RelativeLayout>
This is the java code which you have to write on Java activity.
Java Code
package com.example.faraz.poetryapp;import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import static com.example.faraz.poetryapp.R.id.ListView01;
public class Second2ListView extends Activity { ListView lv; String lv_arr[] = {"गति - मति", "अपनी-अपनी क़िस्मत बदलते हैं..", "जहां मैं गूंजता हूं",
"सपने उम्मीद से ", "दोस्तों”};private ArrayAdapter<String>listAdapter ; @Override protected void onCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_second2_list_view); ListView lv=(ListView)findViewById(R.id.ListView01); lv.setAdapter(new ArrayAdapter<String>(Second2ListView.this,
android.R.layout.simple_list_item_1, lv_arr));lv.setOnItemClickListener(new AdapterView.OnItemClickListener(){public void onItemClick(AdapterView<?> adapter, Viewview, int position, long arg){switch (position) {
case 0: Intent newActivity = new Intent(Second2ListView.this, NextActivity.class); startActivity(newActivity);break; }}} ); }}
The above program shows output like this. The words written in green between inverted comma
(“गति - मति “) will be shown in a line, next words after comma ("अपनी-अपनी क़िस्मत बदलते हैं..") will be
shown in next line.
Note:
- Package name (the first line of this program) will be generating automatically in your project. Don’t copy package name of this program.
- The most important point, from where you will get typed lines in Hindi? MS word and its fonts will not support Android studio Google IDE. For this you have to use online Hindi input tools. Simply type in that tool and copy paste data from there to Android studio activity.

No comments:
Post a Comment