|
hey all. I am new in android programming. i tried to fill a listview with the datas that i pull from a Xml. I did almost everything and it works fine for now. But the images(320 X 230) in Listview can be seen in some devices(Samsung Galaxy Note 2 but imitation one) and in some devices cant be seen(Samsung Galaxy Note 3, HTC One M7, Samsung Galaxy S4) Can it be because of resolution problems or any other reason ?
vemedya.com
|
|
|
|
|
[edit]
I edited this message and it is now (incorrectly) under my name!
Can't find a way to go back to the original user.
[/edit]
package com.example.abcpos;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.GridView;
public class OrderMenu extends Activity {
private GridView gridView;
private GridViewAdapter customGridAdapter;
<a href="http://www.codeproject.com/Members/override">@Override</a>
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_order_menu);
:sigh: :sigh: :sigh:
gridView = (GridView) findViewById(R.id.??????)
}
<a href="http://www.codeproject.com/Members/override">@Override</a>
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.order_menu, menu);
return true;
}
<a href="http://www.codeproject.com/Members/override">@Override</a>
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
<RelativeLayout 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: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.abcpos.OrderMenu" >
<GridView
android:id="@+id/grdOrderMenu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:numColumns="3" />
</RelativeLayout>
Sign
modified 21-Nov-14 11:20am.
|
|
|
|
|
Richard MacCutchan wrote: I edited this message and it is now (incorrectly) under my name! How were you able to edit it if it did not already belong to you?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Some of us have extra privileges.
|
|
|
|
|
Can anyone tell me how to implement ListFragment with corresponding detailed fragments. I want to display listview in one side of the tablet when onclick of list item it should display corresponding xml layouts in same activity.
-- modified 18-Nov-14 1:47am.
|
|
|
|
|
Are you using Eclipse or Android Studio? Both have a Master/Detail Flow option when creating a new project. Try that to see what it puts together for you.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Then please go ahead and do it, and stop posting these non-questions here.
|
|
|
|
|
my project asp.net web base project complate...my web project attach android application..
then working same same web and android ?????????
,so i want help from android application????
,give me lots of ideas....
|
|
|
|
|
It starting to be a bit annoying - don't you think so!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
תפסיק לספר לה' כמה הצרות שלך גדולות, תספר לצרות שלך כמה ה' גדול!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
owais_ahmed_ansari wrote: give me lots of ideas Here are a couple:
|
|
|
|
|
Hi!I have in MainActivity textView,whole show contents files (which located in the folder). I need show contents next file (which located in the folder) when click on button. I hope the problem is clear)))
Thanks in advance.
P.S. Now code looks like this:
TextView myTv;
String res = "";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.universal);
myTv = (TextView) findViewById(R.id.textView);
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(
getAssets().open("universal")));
String myLine = reader.readLine();
while (myLine != null) {
res += myLine + "\n";
myLine = reader.readLine();
}
reader.close();
} catch (IOException e) {
Toast.makeText(getApplicationContext(),
"Error Opening the File !!!", Toast.LENGTH_LONG).show();
}
myTv.setText(res);
modified 11-Nov-14 10:44am.
|
|
|
|
|
Kroshandowski wrote: P.S. Now code looks like this: But what's the problem? Be specific. Have you stepped through the code using the debugger?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Hi All;
Please help as I am going nuts.
Whenever I start a new application I always run it 'naked' just to confirm that everything is ok. From this afternoon all applications I create are coming up with the error as in the logcat dump below. As far as I can see the activity_main.xml file is correct and there is only this one form in the project.
All old applications run ok without hiccups.
Any help appreciated.
Regards
Eric
activity_main.xml
<RelativeLayout 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: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.mysecondapp.MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</RelativeLayout>
LogCat Dump
10-30 17:36:54.762: I/dalvikvm(1792): Could not find method android.view.ViewGroup.onNestedScrollAccepted, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onNestedScrollAccepted
10-30 17:36:54.762: W/dalvikvm(1792): VFY: unable to resolve virtual method 11378: Landroid/view/ViewGroup;.onNestedScrollAccepted (Landroid/view/View;Landroid/view/View;I)V
10-30 17:36:54.762: D/dalvikvm(1792): VFY: replacing opcode 0x6f at 0x0000
10-30 17:36:54.772: I/dalvikvm(1792): Could not find method android.view.ViewGroup.onStopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.onStopNestedScroll
10-30 17:36:54.772: W/dalvikvm(1792): VFY: unable to resolve virtual method 11384: Landroid/view/ViewGroup;.onStopNestedScroll (Landroid/view/View;)V
10-30 17:36:54.772: D/dalvikvm(1792): VFY: replacing opcode 0x6f at 0x0000
10-30 17:36:54.782: I/dalvikvm(1792): Could not find method android.support.v7.internal.widget.ActionBarOverlayLayout.stopNestedScroll, referenced from method android.support.v7.internal.widget.ActionBarOverlayLayout.setHideOnContentScrollEnabled
10-30 17:36:54.782: W/dalvikvm(1792): VFY: unable to resolve virtual method 8957: Landroid/support/v7/internal/widget/ActionBarOverlayLayout;.stopNestedScroll ()V
10-30 17:36:54.782: D/dalvikvm(1792): VFY: replacing opcode 0x6e at 0x000e
10-30 17:36:54.792: D/AndroidRuntime(1792): Shutting down VM
10-30 17:36:54.792: W/dalvikvm(1792): threadid=1: thread exiting with uncaught exception (group=0xb2b10ba8)
10-30 17:36:54.812: E/AndroidRuntime(1792): FATAL EXCEPTION: main
10-30 17:36:54.812: E/AndroidRuntime(1792): Process: com.example.mysecondapp, PID: 1792
10-30 17:36:54.812: E/AndroidRuntime(1792): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mysecondapp/com.example.mysecondapp.MainActivity}: java.lang.RuntimeException: Binary XML file line #27: You must supply a layout_width attribute.
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.ActivityThread.access$800(ActivityThread.java:135)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.os.Handler.dispatchMessage(Handler.java:102)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.os.Looper.loop(Looper.java:136)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.ActivityThread.main(ActivityThread.java:5017)
10-30 17:36:54.812: E/AndroidRuntime(1792): at java.lang.reflect.Method.invokeNative(Native Method)
10-30 17:36:54.812: E/AndroidRuntime(1792): at java.lang.reflect.Method.invoke(Method.java:515)
10-30 17:36:54.812: E/AndroidRuntime(1792): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
10-30 17:36:54.812: E/AndroidRuntime(1792): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
10-30 17:36:54.812: E/AndroidRuntime(1792): at dalvik.system.NativeStart.main(Native Method)
10-30 17:36:54.812: E/AndroidRuntime(1792): Caused by: java.lang.RuntimeException: Binary XML file line #27: You must supply a layout_width attribute.
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.content.res.TypedArray.getLayoutDimension(TypedArray.java:492)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.view.ViewGroup$LayoutParams.setBaseAttributes(ViewGroup.java:5948)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.view.ViewGroup$MarginLayoutParams.<init>(ViewGroup.java:6117)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.support.v7.internal.widget.ActionBarOverlayLayout$LayoutParams.<init>(ActionBarOverlayLayout.java:801)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.support.v7.internal.widget.ActionBarOverlayLayout.generateLayoutParams(ActionBarOverlayLayout.java:353)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.support.v7.internal.widget.ActionBarOverlayLayout.generateLayoutParams(ActionBarOverlayLayout.java:50)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.view.LayoutInflater.rInflate(LayoutInflater.java:757)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.support.v7.app.ActionBarActivityDelegateBase.ensureSubDecor(ActionBarActivityDelegateBase.java:273)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.support.v7.app.ActionBarActivityDelegateBase.setContentView(ActionBarActivityDelegateBase.java:225)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.support.v7.app.ActionBarActivity.setContentView(ActionBarActivity.java:102)
10-30 17:36:54.812: E/AndroidRuntime(1792): at com.example.mysecondapp.MainActivity.onCreate(MainActivity.java:13)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.Activity.performCreate(Activity.java:5231)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-30 17:36:54.812: E/AndroidRuntime(1792): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
10-30 17:36:54.812: E/AndroidRuntime(1792): ... 11 more
10-30 17:36:57.842: I/Process(1792): Sending signal. PID: 1792 SIG: 9
modified 6-Nov-14 6:02am.
|
|
|
|
|
In your RelativeLayout section try substituting "match_parent" with "wrap_content"
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
|
|
|
|
|
Hi Dominic;
Thanks for your reply. I will try it out.
Sorry did not reply earlier. I was sick.
Eric
|
|
|
|
|
I have "match_parent" in mine and it works fine.
|
|
|
|
|
Are you using Eclipse or Android Studio? If the former, are there any syntax errors (red X on the left side) with that XML file?
Also, should tools:context be "com.example.mysecondapp.MainActivity" instead?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 3-Nov-14 23:08pm.
|
|
|
|
|
I use Android Developer Tools which is basically Eclipse from what I can understand.
|
|
|
|
|
I think David's second suggestion may be worth looking at.
|
|
|
|
|
hi
how can i record screen in android?
for example i want to record all user activity in screen such as playing movie or read sms or ..., i want to the code(app) record all activity in video format
thank you all
|
|
|
|
|
|
Hi all;
I must start this discussion with three statements.
(a) I am one of those who learns by doing
(b) I have a basic understanding of Android programming
(c) I am a .NET developer (ie: I know how to program).
What I seek is advise on how to go about developing an application I have in mind. This application will be running in the background (therefore a Service) periodically polling a URL to check for new messages. If a new message is found, a notification or toast is displayed. So far, so good. I think I know how to do all that. The service will start automatically at device boot up. This, I think, I have also found how to do.
The problem I have is that as part of the same application I want a UI which the user can then use to process the received message/s. How do I go about implementing this within the same app.
The aim is to have ONE installation package.
I do not think what I seek is rocket science. I would appreciate any notes or links to relevant guides or tutorials.
Regards
Eric
|
|
|
|
|
|
|
I'm not entirely clear what your question relates to. Are you asking how to build the UI or how to process the received messages? Can you clarify what you need help with. What are you trying to achieve?
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare
|
|
|
|