farrell2k's Profile User Rating: -----

Reputation: 797 Master
Group:
Expert
Active Posts:
2,422 (2.44 per day)
Joined:
29-July 11
Profile Views:
25,838
Last Active:
User is online 23 minutes ago
Currently:
Viewing Topic: AndroidManifest could not be found

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
AMD
Favorite Gaming Platform:
PC
Your Car:
Hyundai
Dream Kudos:
175
Expert In:
Java

Latest Visitors

Icon   farrell2k has not set their status

Posts I've Made

  1. In Topic: AndroidManifest could not be found

    Posted 18 Apr 2014

    This just happened to me tonight. What I did to fix it was made a change to the manifest and removed it, which allowed me to re-save the file. All is well now.
  2. In Topic: ListView Custom items

    Posted 11 Apr 2014

    imageView.setImageResource(item.someInt);

    This is your problem. The method looking for somethng like R.drawarlbe.xxx, which is represented by android as an int, but you cannot just put in any old int. This is why it is not drawing anything. One easy way to adapt your code is to create an int array and add all the R.drawables to it, then in your code for the adapter, just reference the position in the array.

    int[] drawables = new int[3]
    drawables[0] = R.drawable.xxx;
    imageView.setImageResource(drawables[position]);
    
    


    There are plenty of examples of this on the googles.
  3. In Topic: If / ElseIf Button IDs

    Posted 8 Apr 2014

    Sometimes examples are best.

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context="com.example.testx.MainActivity"
        tools:ignore="MergeRootFrame" >
        <Button
            android:id="@+id/btn1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn1"/>
    
            <Button
            android:id="@+id/btn2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="btn2"/>
        
    </LinearLayout>
    
    


    public class MainActivity extends Activity implements onclickListener {
    	private Button btn1;
    	private Button btn2;
    	
    	@Override
    	protected void onCreate(Bundle savedInstanceState) {
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.activity_main);
    
    		btn1 = (Button)findViewById(R.id.btn1);
    		btn1.setonclickListener(this);
    		btn2 = (Button)findViewById(R.id.btn2);
    		btn2.setonclickListener(this);
    	}
    
    	//implemented from View.onclickListener
    	@Override
    	public void onclick(View v) {
    		sendMessage(v);
    		
    	}
    	
    	private void sendMessage(View v) {
    		if (v == btn1) {
    			Toast.makeText(this, "btn1 clicked", Toast.LENGTH_LONG).show();
    		}
    		
    		else if (v == btn2) {
    			Toast.makeText(this, "btn2 clicked", Toast.LENGTH_LONG).show();
    		}
    	}
    }
    
    


    The site editor may have screwed up camel case for method names. Watch out for it.
  4. In Topic: If / ElseIf Button IDs

    Posted 8 Apr 2014

    You can just use the name of the variable referencing the button.

    if button == openbutton.
  5. In Topic: How Do You Dispose Objects In Android And Use Garbage Collection?

    Posted 6 Apr 2014

    Eh, you kind of should worry about leaking context from one activity to another with Intents. You will quickly find that they eat up a lot of memory, and it is really easy to do. Just like anything in Java, an intent will be collected when there are no living references to it, so when you do:

    Intent i = new Intent(this, MyClass.class);
    startActivity(i)
    //then
    Intent j = new Intent(this, MyClassOther.class);
    startActivity(j);
    Intent k = new Intent(this, MyClassOtherOther.class);
    startActivity(k)
    
    


    You end up with a long chaing of Intents that are left consuming memory. when you are going to be switching between Activities like this, call getApplicationContext() instead. This way the Intent can be recycled when it needs to be.

My Information

Member Title:
D.I.C Lover
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:
Years Programming:
4
Programming Languages:
Java, but willing to deal with C#

Contact Information

E-mail:
Private

Comments

farrell2k has no profile comments yet. Why not say hello?