Twitter Facebook Delicious Digg Stumbleupon Favorites More

Tuesday 28 August 2018

background music android

 MediaPlayer mediaPlayer;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        //To play background sound
        if (getInt("Sound", 0) == 0) {
            mediaPlayer = MediaPlayer.create(this, R.raw.abc);
            mediaPlayer.start();
            mediaPlayer.setLooping(true);
        }
    }
Share:

Friday 24 August 2018

login page ui design


https://www.youtube.com/watch?v=8PdYiQNYqr8     code and design
activity_main

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_height="match_parent"
   tools:context="com.example.user.loginapp.MainActivity"
   android:background="#fff"
   android:orientation="vertical">



   <RelativeLayout
       android:layout_width="match_parent"
       android:layout_height="370dp">


       <LinearLayout
           android:layout_width="match_parent"
           android:layout_height="320dp"
           android:background="@drawable/bg"
           android:padding="20dp"
           android:orientation="vertical">


           <RelativeLayout
               android:layout_width="match_parent"
               android:layout_height="wrap_content">

               <Button
                   android:layout_width="45dp"
                   android:layout_height="47dp"
                   android:background="@drawable/menu"
                   android:layout_alignParentLeft="true"/>

               <Button
                   android:layout_width="45dp"
                   android:layout_height="47dp"
                   android:background="@drawable/logo"
                   android:layout_alignParentRight="true"/>

           </RelativeLayout><!--Menu-->


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

               <TextView
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"
                   android:text="LOGIN"
                   android:textStyle="bold"
                   android:textSize="24dp"
                   android:layout_marginTop="10dp"
                   android:textColor="#fff"/>

               <EditText
                   android:layout_width="220dp"
                   android:layout_height="wrap_content"
                   android:hint="username"
                   android:gravity="center"
                   android:background="@drawable/inp_rou"
                   android:padding="8dp"
                   android:textColorHint="#626262"
                   android:layout_marginTop="10dp"/>

               <EditText
                   android:layout_width="220dp"
                   android:layout_height="wrap_content"
                   android:hint="password"
                   android:gravity="center"
                   android:background="@drawable/inp_rou"
                   android:padding="8dp"
                   android:textColorHint="#626262"
                   android:layout_marginTop="15dp"/>

               <Button
                   android:layout_width="90dp"
                   android:layout_height="40dp"
                   android:hint="Go !"
                   android:textSize="22dp"
                   android:textColorHint="#fff"
                   android:background="@drawable/go_btn"
                   android:layout_marginTop="15dp"/>

           </LinearLayout>



       </LinearLayout><!--Menu and login-->


       <RelativeLayout
           android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:gravity="center">

           <ImageView
               android:layout_width="80dp"
               android:layout_height="80dp"
               android:background="@drawable/roundbtn"
               android:layout_marginTop="290dp"/>

       </RelativeLayout>



   </RelativeLayout><!--Top content-->



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

       <Button
           android:layout_width="280dp"
           android:layout_height="wrap_content"
           android:hint="Login with facebook"
           android:background="@drawable/fb_btn"
           android:textColorHint="#fff"
           android:textSize="16dp"
           android:layout_marginTop="15dp"
           android:drawableStart="@drawable/fb"
           android:paddingLeft="20dp"/>

       <Button
           android:layout_width="280dp"
           android:layout_height="wrap_content"
           android:hint="Login with Twitter"
           android:background="@drawable/tw_btn"
           android:textColorHint="#fff"
           android:textSize="16dp"
           android:layout_marginTop="15dp"
           android:drawableStart="@drawable/tw"
           android:paddingLeft="20dp"/>

       <Button
           android:layout_width="280dp"
           android:layout_height="wrap_content"
           android:padding="6dp"
           android:hint="Create An Account"
           android:background="@null"
           android:textColorHint="#656565"
           android:textSize="16dp"
           android:layout_marginTop="15dp"/>


   </LinearLayout>


   <TableRow
       android:layout_height="1dp"
       android:layout_width="300dp"
       android:layout_gravity="center_horizontal"
       android:orientation="vertical"
       android:background="#656565"
       android:layout_marginTop="15dp"></TableRow>


   <LinearLayout
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:orientation="horizontal"
       android:layout_gravity="center"
       android:layout_marginTop="10dp">

       <Button
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:hint="ABOUT"
           android:textColorHint="#656565"
           android:background="@null"/>

       <Button
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"
           android:hint="CONTACT"
           android:textColorHint="#656565"
           android:background="@null"/>


   </LinearLayout>



</LinearLayout>







Fb button
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

   <solid android:color="@color/colorfacebok"></solid>
   <corners android:radius="6dp"></corners>

</shape>

Tw button
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

   <solid android:color="@color/colorTwitter"></solid>
   <corners android:radius="6dp"></corners>

</shape>

Go_btn

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

   <stroke android:color="#fff" android:width="2dp"></stroke>
   <corners android:radius="6dp"></corners>

</shape>

Inp_round

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

   <solid android:color="#fff"></solid>
   <corners android:radius="6dp"></corners>

</shape>





Share:

Monday 20 August 2018

uber type clone index

https://www.youtube.com/channel/UCIHBIPape0dWHKANkivrcJw   coding cafe

  1. splash screen 
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1
  • 1

Share:

uber cab clone android tutorials splash screen

package lovelycabs.lovelycabs;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

public class splash extends AppCompatActivity {

    @Override    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        Thread thread = new Thread() {
            public void run() {
                try {
                    sleep(5000);
                } catch (Exception e)

                {
                    e.printStackTrace();
                } finally {
                    Intent intent = new Intent(getApplicationContext(), MainActivity.class);
                    startActivity(intent);
                    finish();
                }
            }
        };
        thread.start();
    }
}

Share:

Saturday 18 August 2018

floating action with share option


  1. 1xml 
  <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="170dp"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_marginBottom="19dp"
        android:layout_marginEnd="25dp"
        android:clickable="true"
        app:fabSize="normal"
        app:srcCompat="@drawable/share" />   


 implementation 'com.android.support:design:27.0.0'

  1. 2
floatButton = (ImageButton) findViewById(R.id.fab);
        floatButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(Intent.ACTION_SEND);
                i.setType("text/plain");
                String shareBody="Downdload Love percentage calculator Here https://play.google.com/store/apps/details?id=lovecalculator.lovecalculator";
                String shareSub="Downdload Love percentage calculator Here https://play.google.com/store/apps/details?id=lovecalculator.lovecalculator";

                i.putExtra(Intent.EXTRA_SUBJECT,shareBody);
                i.putExtra(Intent.EXTRA_TEXT,shareSub);
                startActivity(Intent.createChooser(i,"SHARE USING"));

            }
        });
  1. 3
Share:

Wednesday 15 August 2018

TO DO APP TUTOTIAL


  1. DB HELPER 

package com.todo.raj.todo;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import java.util.ArrayList;

public class DbHelper extends SQLiteOpenHelper {
    private static final String DB_NAME="VirajToDo";
    private static final int DB_VER = 1;
    public static final String DB_TABLE="Task";
    public static final String DB_COLUMN = "TaskName";

    public DbHelper(Context context) {
        super(context, DB_NAME, null, DB_VER);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        String query = String.format("CREATE TABLE %s (ID INTEGER PRIMARY KEY AUTOINCREMENT,%s TEXT NOT NULL);",DB_TABLE,DB_COLUMN);
        db.execSQL(query);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        String query = String.format("DELETE TABLE IF EXISTS %s",DB_TABLE);
        db.execSQL(query);
        onCreate(db);
    }

    public void insertNewTask(String task){
        SQLiteDatabase db= this.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put(DB_COLUMN,task);
        db.insertWithOnConflict(DB_TABLE,null,values,SQLiteDatabase.CONFLICT_REPLACE);
        db.close();
    }

    public void deleteTask(String task){
        SQLiteDatabase db = this.getWritableDatabase();
        db.delete(DB_TABLE,DB_COLUMN + " = ?",new String[]{task});
        db.close();
    }

    public ArrayList<String> getTaskList(){
        ArrayList<String> taskList = new ArrayList<>();
        SQLiteDatabase db = this.getReadableDatabase();
        Cursor cursor = db.query(DB_TABLE,new String[]{DB_COLUMN},null,null,null,null,null);
        while(cursor.moveToNext()){
            int index = cursor.getColumnIndex(DB_COLUMN);
            taskList.add(cursor.getString(index));
        }
        cursor.close();
        db.close();
        return taskList;
    }
}


  1. 2MAIN ACTIVITY 

package com.todo.raj.todo;

import android.content.DialogInterface;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    DbHelper dbHelper;
    ArrayAdapter<String> mAdapter;
    ListView lstTask;

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

        dbHelper = new DbHelper(this);

        lstTask = (ListView)findViewById(R.id.lstTask);

        loadTaskList();


        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
/*
        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
//                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
//                        .setAction("Action", null).show();

            }
        });*/
    }

    private void loadTaskList() {
        ArrayList<String> taskList = dbHelper.getTaskList();
        if(mAdapter==null){
            mAdapter = new ArrayAdapter<String>(this,R.layout.row,R.id.task_title,taskList);
            lstTask.setAdapter(mAdapter);
        }
        else{
            mAdapter.clear();
            mAdapter.addAll(taskList);
            mAdapter.notifyDataSetChanged();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);

        //Change menu icon color
        Drawable icon = menu.getItem(0).getIcon();
        icon.mutate();
        icon.setColorFilter(getResources().getColor(android.R.color.white), PorterDuff.Mode.SRC_IN);

        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        switch (item.getItemId()){
            case R.id.action_add_task:
                final EditText taskEditText = new EditText(this);
                AlertDialog dialog = new AlertDialog.Builder(this)
                        .setTitle("Add New Task")
                        .setMessage("What do you want to do next?")
                        .setView(taskEditText)
                        .setPositiveButton("Add", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                String task = String.valueOf(taskEditText.getText());
                                dbHelper.insertNewTask(task);
                                loadTaskList();
                            }
                        })
                        .setNegativeButton("Cancel",null)
                        .create();
                dialog.show();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }

    public void deleteTask(View view){
        View parent = (View)view.getParent();
        TextView taskTextView = (TextView)parent.findViewById(R.id.task_title);
        Log.e("String", (String) taskTextView.getText());
        String task = String.valueOf(taskTextView.getText());
        dbHelper.deleteTask(task);
        loadTaskList();
    }
}


  1. 3MAIN ACTIVITY XML 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".MainActivity"
    tools:showIn="@layout/activity_main">

    <ListView
        android:id="@+id/lstTask"
    android:layout_width="match_parent"
    android:layout_height="match_parent"></ListView>


</LinearLayout>

  1. 4ROW.XML

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TextView
            android:id="@+id/task_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:text="Example"
            android:textSize="20sp" />

        <Button
            android:id="@+id/btnDelete"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:onClick="deleteTask"
            android:text="DELETE" />
    </RelativeLayout>

</android.support.constraint.ConstraintLayout>

  1. 5MENU_MAIN.XML

<menu 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"
    tools:context="com.todo.raj.todo.MainActivity">
   <!-- <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        app:showAsAction="never" />
-->
    <item
        android:id="@+id/action_add_task"
        android:icon="@android:drawable/ic_menu_add"
        android:title="Add New Task"
        app:showAsAction="always"
        />
</menu>


  1. 6GRADEL

  implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.0.0'
Share:

Saturday 11 August 2018

Text Recognition by Camera using Google Vision


  1. MANIFEST     

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.raj.imagetowordconverter">

    <uses-permission android:name="android.permission.CAMERA"></uses-permission>

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <meta-data
            android:name="com.google.android.gms.vision.DEPENDENCIES"
            android:value="ocr">

        </meta-data>


    </application>

</manifest>
  1. 2 MAIN ACTIVITY
package com.example.raj.imagetowordconverter;

import android.Manifest;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.util.SparseArray;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.android.gms.vision.CameraSource;
import com.google.android.gms.vision.Detector;
import com.google.android.gms.vision.Frame;
import com.google.android.gms.vision.text.TextBlock;
import com.google.android.gms.vision.text.TextRecognizer;

import java.io.IOException;

public class MainActivity extends AppCompatActivity {

    SurfaceView cameraview;
    CameraSource cameraSource;
    final int RequestCameraPermisionID = 1001;
    TextView txtResult;

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        switch (requestCode) {
            case RequestCameraPermisionID: {
                if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
                    if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED)

                        return;
                }
                try {
                    cameraSource.start(cameraview.getHolder());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }

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

        cameraview = (SurfaceView) findViewById(R.id.surface_view);
        txtResult = (TextView) findViewById(R.id.result);

        TextRecognizer textRecognizer = new TextRecognizer.Builder(getApplicationContext()).build();

        if (!textRecognizer.isOperational()) {
            Log.e("ERROR", "DECTOR ARE OT FUNCTIONAL");
        } else {
            cameraSource = new CameraSource.Builder(getApplicationContext(), textRecognizer)
                    .setFacing(CameraSource.CAMERA_FACING_BACK)
                    .setRequestedPreviewSize(1280, 1024)
                    .setRequestedFps(2.0f)
                    .setAutoFocusEnabled(true).build();
            cameraview.getHolder().addCallback(new SurfaceHolder.Callback() {


                @Override
                public void surfaceCreated(SurfaceHolder holder) {
                    try {

                        if (ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
                            // TODO: Consider calling
                            ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.CAMERA},
                                    RequestCameraPermisionID);

                            return;
                        }

                        cameraSource.start(cameraview.getHolder());

                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

                }

                @Override
                public void surfaceDestroyed(SurfaceHolder holder) {
                    cameraSource.stop();
                }
            });

            //----------------
            textRecognizer.setProcessor(new Detector.Processor<TextBlock>() {
                @Override
                public void release() {

                }

                @Override
                public void receiveDetections(Detector.Detections<TextBlock> detections) {
                    final SparseArray<TextBlock> items = detections.getDetectedItems();
                    if (items.size() != 0) {
                        txtResult.post(new Runnable() {
                            @Override
                            public void run() {
                                StringBuilder stringBuilder = new StringBuilder();
                                for (int i = 0; i < items.size(); ++i) {
                                    TextBlock item = items.valueAt(i);
                                    stringBuilder.append(item.getValue());
                                    stringBuilder.append("\n");
                                }
                                txtResult.setText(stringBuilder.toString());
                            }
                        });
                    }
                }
            });
            //----------------

        }
    }


}

  1. 3
<?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-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity">


    <SurfaceView
        android:id="@+id/surface_view"
        android:layout_width="match_parent"
        android:layout_height="200dp"
        android:layout_gravity="center_horizontal"
        android:scaleType="center" />

    <TextView
        android:id="@+id/result"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"

        android:layout_alignParentBottom="true"

        android:layout_below="@id/surface_view"
        android:text="NO TEXT"
        android:textColor="@color/colorAccent"
        android:textSize="24sp" />


</RelativeLayout>
  1. 4
  2. 5
  3. 6
Share:

Text Recognition using Google Vision


  1. 1android mainfest 
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  4.     package="com.example.raj.imagetowordconverter">

  5.     <application
  6.         android:allowBackup="true"
  7.         android:icon="@mipmap/ic_launcher"
  8.         android:label="@string/app_name"
  9.         android:roundIcon="@mipmap/ic_launcher_round"
  10.         android:supportsRtl="true"
  11.         android:theme="@style/AppTheme">
  12.         <activity android:name=".MainActivity">
  13.             <intent-filter>
  14.                 <action android:name="android.intent.action.MAIN" />

  15.                 <category android:name="android.intent.category.LAUNCHER" />
  16.             </intent-filter>
  17.         </activity>

  18.         <meta-data
  19.             android:name="com.google.android.gms.vision.DEPENDENCIES"
  20.             android:value="ocr">

  21.         </meta-data>


  22.     </application>

  23. </manifest>

  1. 2 xml 
  2. <?xml version="1.0" encoding="utf-8"?>
  3. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  4.     xmlns:app="http://schemas.android.com/apk/res-auto"
  5.     xmlns:tools="http://schemas.android.com/tools"
  6.     android:layout_width="match_parent"
  7.     android:layout_height="match_parent"
  8.     tools:context=".MainActivity"
  9.     android:orientation="vertical">


  10.     <ImageView
  11.         android:layout_gravity="center_horizontal"
  12.         android:scaleType="center"
  13.         android:layout_width="wrap_content"
  14.         android:layout_height="wrap_content"
  15.         android:id="@+id/image_view"/>

  16.     <Button
  17.         android:layout_below="@id/image_view"
  18.         android:layout_gravity="center_horizontal"
  19.         android:id="@+id/button_process"
  20.         android:layout_width="match_parent"
  21.         android:layout_height="wrap_content"
  22.         android:text="PROCESS"
  23.         />
  24.     <TextView
  25.         android:layout_below="@id/button_process"

  26.         android:id="@+id/result"
  27.         android:gravity="center_horizontal"
  28.         android:layout_width="match_parent"
  29.         android:layout_height="wrap_content"
  30.         android:text="NO TEXT"
  31.         android:textSize="24sp"
  32.         />
  33. </RelativeLayout>

  1. 2 main activity 
  2. package com.example.raj.imagetowordconverter;

  3. import android.graphics.Bitmap;
  4. import android.graphics.BitmapFactory;
  5. import android.support.v7.app.AppCompatActivity;
  6. import android.os.Bundle;
  7. import android.util.Log;
  8. import android.util.SparseArray;
  9. import android.view.View;
  10. import android.widget.Button;
  11. import android.widget.ImageView;
  12. import android.widget.TextView;

  13. import com.google.android.gms.vision.Frame;
  14. import com.google.android.gms.vision.text.TextBlock;
  15. import com.google.android.gms.vision.text.TextRecognizer;

  16. public class MainActivity extends AppCompatActivity {

  17.     ImageView imageView;
  18.     Button btnp_rocess;
  19.     TextView txtResult;

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

  24.     imageView=(ImageView)findViewById(R.id.image_view);
  25.     btnp_rocess=(Button)findViewById(R.id.button_process);
  26.     txtResult=(TextView)findViewById(R.id.result);

  27.         final Bitmap bitmap= BitmapFactory.decodeResource(
  28.                 getApplicationContext().getResources(),R.drawable.txt
  29.         );

  30.         imageView.setImageBitmap(bitmap);

  31.         btnp_rocess.setOnClickListener(new View.OnClickListener() {
  32.             @Override
  33.             public void onClick(View v) {
  34.                 TextRecognizer textRecognizer=new TextRecognizer.Builder(getApplicationContext()).build();

  35.             if (!textRecognizer.isOperational())
  36.                 Log.e("ERROR","DECTOR ARE OT FUNCTIONAL");
  37.             else {
  38.                 Frame frame=new Frame.Builder().setBitmap(bitmap).build();
  39.                 SparseArray<TextBlock> items=textRecognizer.detect(frame);
  40.                 StringBuilder stringBuilder=new StringBuilder();
  41.                 for (int i=0;i<items.size();++i)
  42.                 {
  43.                     TextBlock item=items.valueAt(i);
  44.                     stringBuilder.append(item.getValue());
  45.                     stringBuilder.append("\n");
  46.                 }
  47.                 txtResult.setText(stringBuilder.toString());
  48.             }
  49.             }
  50.         });
  51.     }
  52. }
Share:

Render problem Failed to find style 'coordinatorLayoutStyle' in current theme Missing styles. Is the correct theme chosen for this layout? failed to instantitte one or more classes

Render problem Failed to find style 'coordinatorLayoutStyle' in current theme Missing styles. Is the correct theme chosen for this layout? failed to instantiate one or more classes


achange sdk 28 to 27 and go to Tools >> sdk manager and download API LEVEL 27


apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.raj.test"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Share:

ConstraintLayout problem solution AUGUST 2018

change sdk 28 to 27 and go to Tools >> sdk manager and download API LEVEL 27


apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.example.raj.test"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:design:27.0.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

Share:

udacity android apps detail









TERM 1

Android Developer

We built this Nanodegree program in partnership with Google for students with intermediate programming skills who want to become professional Android developers. By the end of this program, you’ll have a diverse portfolio of projects to show employers, including your own app on Google Play.
SEE FEWER DETAILS
4 months to complete
PREREQUISITE KNOWLEDGE
You should have 1-2 years of experience programming in Java or another object-oriented language like Python or C++, and must be proficient using Git and GitHub.See detailed requirements.








  • Welcome to Your Nanodegree program


    Welcome! Here’s an overview of the program where you’ll create an Android app, along with some helpful resources to get you started.




  • Developing Android Apps


    Work with instructors step-by-step to build a cloud-connected Android app. Blending theory and practice, learn how to build great apps the right way.
    SANDWICH CLUBPOPULAR MOVIES, STAGE 1POPULAR MOVIES, STAGE 2




  • Advanced Android App Development


    Make your apps more responsive, and create a total user experience with home screen widgets, third-party libraries, and more. Also, learn to deeply integrate rich media, test user interfaces, and publish to Google Play.
    BAKING APP








TERM 2

Android Developer

We built this Nanodegree program in partnership with Google for students with intermediate programming skills who want to become professional Android developers. By the end of this program, you’ll have a diverse portfolio of projects to show employers, including your own app on Google Play.
SEE FEWER DETAILS
4 months to complete
PREREQUISITE KNOWLEDGE
You should have 1-2 years of experience programming in Java or another object-oriented language like Python or C++, and must be proficient using Git and GitHub.See detailed requirements.








  • Gradle for Android and Java


    Learn how to customize your Gradle build, and explore advanced topics like app testing, configuring free vs. paid apps, and creating and integrating libraries.
    BUILD IT BIGGER




  • Material Design for Android Developers


    Apply the design principles that define Android's visual language to your apps, using material design elements, transitions and graphics, across multiple form factors.
    MAKE YOUR APP MATERIAL




  • Capstone Project


    Integrate all you've learned in this program to bring your own app idea to life, and publish your app to Google Play.
    CAPSTONE, STAGE 1 - DESIGNCAPSTONE, STAGE 2 - BUILD
https://misk.org.sa/wp-content/uploads/2017/09/ABND-Syllabus.pdf

List of projects

  1. A Single Screen App
  2. Score Keeper App
  3. Quiz App
  4. Music Structure App
  5. Repord Card
  6. Tour Guide App
  7. Book Listing App
  8. News App
  9. Habit Tracker App
  10. Inventory App

Share:

Search This Blog

Popular Posts

Pages

how to make crores from 1 lakh in stock markets in 1 year

how to make crores from 1 lakh in stock markets in 1 year

Blogger Tutorials

Blogger Templates

Sample Text

Copyright © ANDROID TUTORIAL CODE | Powered by Blogger
Design by SimpleWpThemes | Blogger Theme by NewBloggerThemes.com & Distributed By Protemplateslab