[Solved] Update TextView from another Activity

I don’t think there is a good way to do this, as your first activity could get collected by the system, and you generally don’t want to do work after onPause has been called. I would move that logic that updates the views into a service that runs in the background. Since it sounds like … Read more

[Solved] Boundry around a view

Try this: Border Line inside cardview: <android.support.v7.widget.CardView android:id=”@+id/cardview0″ android:layout_width=”match_parent” android:layout_height=”50dp” android:layout_alignParentTop=”true”> <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_marginLeft=”10dp” android:background=”#000000″> <RelativeLayout android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_marginBottom=”0.5dp” android:layout_marginLeft=”0.5dp” android:layout_marginTop=”0.5dp” android:background=”#ffffff”> <TextView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerVertical=”true” android:layout_gravity=”center_vertical” android:layout_marginLeft=”30dp” android:text=”Circle” android:textColor=”#3B64AE” /> <Spinner android:layout_width=”150dp” android:layout_height=”match_parent” android:layout_alignParentRight=”true”> </Spinner> </RelativeLayout> </RelativeLayout> </android.support.v7.widget.CardView> Border line outside cardview: <RelativeLayout android:layout_width=”match_parent” android:layout_height=”50dp” android:layout_marginLeft=”5dp” android:background=”@drawable/border_line”> <android.support.v7.widget.CardView android:id=”@+id/cardview0″ android:layout_width=”match_parent” android:layout_height=”50dp” android:layout_margin=”1dp” android:layout_alignParentTop=”true”> … Read more

[Solved] How can i prevent my Currency converter app from crashing when button is pressed?

if (dollarfield.getText().toString().equals(“”)) { Toast.makeText(getApplicationContext(), “no value has been entered”, Toast.LENGTH_LONG).show(); } else { Double dollarAmount = Double.parseDouble(dollarfield.getText().toString()); Double poundAmount = dollarAmount * 0.7; Toast.makeText(getApplicationContext(), poundAmount.toString() + “Pounds”, Toast.LENGTH_LONG).show(); } 4 solved How can i prevent my Currency converter app from crashing when button is pressed?

[Solved] Text Message (SMS)

Well… I recomend you to put this on a try{}catch{} to know what’s failing… check this : try { SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(numbers[1], null, msg, null, null); Toast.makeText(getApplicationContext(), “Message Sent”, Toast.LENGTH_LONG).show(); } catch (Exception ex) { Toast.makeText(getApplicationContext(),ex.getMessage().toString(), Toast.LENGTH_LONG).show(); ex.printStackTrace(); } By the way don’t forget to add this on your manifest.xml <uses-permission android:name=”android.permission.SEND_SMS” /> … Read more

[Solved] LayerDrawable auto change background

ShapeDrawable biggerRectDrawable = new ShapeDrawable(new RectShape()); biggerRectDrawable.getPaint().setColor(mActivity.getResources().getColor(R.color.treasure_box_content_bg)); ShapeDrawable smallerRectDrawable = new ShapeDrawable(new RectShape()); smallerRectDrawable.getPaint().setColor(mActivity.getResources().getColor(R.color.common_white)); Drawable[] layers = {smallerRectDrawable, biggerRectDrawable}; LayerDrawable layerDrawable = new LayerDrawable(layers); layerDrawable.setLayerInset(1, 0, mScreenWidth / 3, 0, 0); ViewsApiCompat.setBackground(mTreasureBoxView, layerDrawable); problem solved. bingo. solved LayerDrawable auto change background

[Solved] How to get image URL within HTML tags?

thanks for your answers.i could solve my problem with this code.hope help other guys. $text = $row[“your html text from database row”]; preg_match(‘/< *img[^>]*src *= *[“\’]?([^”\’]*)/i’, $text, $img); $pics=$img[1]; output is ($pics)= ( images/akhbar/5/q103.jpg ) solved How to get image URL within HTML tags?

[Solved] Default Nagivatinal Drawer Layout of Android Studio

Suppose this is the layout of you MainActivity <android.support.v4.widget.DrawerLayout 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:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” android:fitsSystemWindows=”true” tools:openDrawer=”start”> <include layout=”@layout/app_bar_main” android:layout_width=”match_parent” android:layout_height=”match_parent” /> <android.support.design.widget.NavigationView android:id=”@+id/nav_view” android:layout_width=”wrap_content” android:layout_height=”match_parent” android:layout_gravity=”start” android:fitsSystemWindows=”true” app:headerLayout=”@layout/nav_header_main” app:menu=”@menu/activity_main_drawer” /> </android.support.v4.widget.DrawerLayout> Now you want same navigation drawer to other activity i.e Main2Activity add this to other activity <android.support.v4.widget.DrawerLayout 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:id=”@+id/drawer_layout” android:layout_width=”match_parent” android:layout_height=”match_parent” … Read more

[Solved] Android SQlite exceptions which cause the app to crash [closed]

Check this error here. Process: com.example.rockodile.contactsappliaction, PID: 5549 java.lang.IllegalStateException: Couldn’t read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it. at android.database.CursorWindow.nativeGetString(Native Method) at android.database.CursorWindow.getString(CursorWindow.java:438) at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:51) at com.example.rockodile.contactsappliaction.UserSQL.getContactList(UserSQL.java:105) at com.example.rockodile.contactsappliaction.MainActivity.onClick(MainActivity.java:52) Update. public ArrayList<HashMap<String, String>> getContactList() { //Open connection to read only SQLiteDatabase db = dbHelper.getReadableDatabase(); … Read more

[Solved] 2D Game engine for android [closed]

I only used one of them and below its specialities(supports android) as I remember. Others which I dont know about: Jogre –>I dont know if this supports Android, but trying does not hurt env3D –> Supports android. jake2 –>I dont know if this supports Android jpct —> Supports for android. LWJGL —>a good base You … Read more

[Solved] Im trying to make a acsess code for a app

Its called SharedPreferences. Save your access code in SharedPreference and check if you have any. After that, you won’t have any problem with that. SharedPreferences tutorial Hope it helps. Cheers! 1 solved Im trying to make a acsess code for a app

[Solved] No Activity found when navigating to another activity in Android

try this, btnAdd.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Start 2nd Activity if(selectedItem != 0){ insertContact(name, email); } startActivity(new Intent(MainActivity.this, SecondActivity.class)); finish() } }); 5 solved No Activity found when navigating to another activity in Android